Class AnnotationProcessor


  • public class AnnotationProcessor
    extends Object
    AnnotationProcessor contains static helper methods that handle the Turbine annotations for objects
    Version:
    $Id: TurbineAssemblerBrokerService.java 1521103 2013-09-09 13:38:07Z tv $
    Author:
    Thomas Vandahl
    • Method Detail

      • getAnnotations

        public static Annotation[] getAnnotations​(AccessibleObject object)
        Get cached annotations for field, class or method
        Parameters:
        object - a field, class or method
        Returns:
        the declared annotations for the object
      • isAuthorized

        public static <A extends org.apache.fulcrum.security.model.turbine.TurbineAccessControlList<?>> boolean isAuthorized​(AccessibleObject object,
                                                                                                                             A acl)
        Check if the object given is authorized to be executed based on its annotations The method will return false if one of the annotations denies execution
        Type Parameters:
        A - ACL instance
        Parameters:
        object - accessible object to test
        acl - access control list
        Returns:
        true if the execution is allowed
        See Also:
        isAuthorized(AccessibleObject, TurbineAccessControlList, ConditionType)
      • isAuthorized

        public static <A extends org.apache.fulcrum.security.model.turbine.TurbineAccessControlList<?>> boolean isAuthorized​(AccessibleObject object,
                                                                                                                             A acl,
                                                                                                                             AnnotationProcessor.ConditionType conditonType)
        Check if the object given is authorized to be executed based on its annotations The method's return value depends on the conditonType, refer to the ConditionType
        Type Parameters:
        A - ACL instance
        Parameters:
        object - the object
        acl - access control list
        conditonType - either AnnotationProcessor.ConditionType.COMPOUND: The method will return false if one of the annotations denies execution or AnnotationProcessor.ConditionType.ANY : The method will return true if one of the annotations allows execution
        Returns:
        true if the execution is allowed
      • process

        public static void process​(Object object)
                            throws TurbineException
        Search for annotated fields of the object and inject the appropriate objects
        Parameters:
        object - the object
        Throws:
        TurbineException - if the objects could not be injected