/** * Indicates if annotations were defined on this resource. * * @return True if annotations were defined on this resource. */ protected boolean hasAnnotations() { return (getAnnotations() != null) && (!getAnnotations().isEmpty()); }
/** * Invoked when the list of allowed methods needs to be updated. The {@link #getAllowedMethods()} or the * {@link #setAllowedMethods(Set)} methods should be used. The default implementation lists the annotated * methods. */ public void updateAllowedMethods() { getAllowedMethods().clear(); List<AnnotationInfo> annotations = getAnnotations(); if (annotations != null) { for (AnnotationInfo annotationInfo : annotations) { if (annotationInfo instanceof MethodAnnotationInfo) { MethodAnnotationInfo methodAnnotationInfo = (MethodAnnotationInfo) annotationInfo; if (!getAllowedMethods().contains( methodAnnotationInfo.getRestletMethod())) { getAllowedMethods().add( methodAnnotationInfo.getRestletMethod()); } } } } }
/** * Returns the first annotation descriptor matching the given method. * * @param method * The method to match. * @param query * The query parameters. * @param entity * The request entity or null. * @return The annotation descriptor. * @throws IOException */ private MethodAnnotationInfo getAnnotation(Method method, Form query, Representation entity) throws IOException { if (isAnnotated()) { return AnnotationUtils.getInstance().getMethodAnnotation( getAnnotations(), method, query, entity, getMetadataService(), getConverterService()); } return null; }
method = (Method.HEAD.equals(method)) ? Method.GET : method; for (AnnotationInfo annotationInfo : getAnnotations()) { try { if (annotationInfo instanceof MethodAnnotationInfo) {