Class RoleHandlerHelper

    • Method Detail

      • getRoleHandler

        public static RoleHandler getRoleHandler​(Class<? extends CtElement> targetClass,
                                                 CtRole role)
        Parameters:
        targetClass - the class of the to be manipulated node
        role - defines the to be manipulated attribute
        Returns:
        RoleHandler implementation which knows how to manipulate the attribute of CtRole on `targetClass` or throws exception if such role doesn't exist on the `targetClass`
      • getOptionalRoleHandler

        public static RoleHandler getOptionalRoleHandler​(Class<? extends CtElement> targetClass,
                                                         CtRole role)
        Parameters:
        targetClass - the Class of the to be manipulated node
        role - defines the to be manipulated attribute
        Returns:
        RoleHandler implementation, which knows how to manipulate the attribute of CtRole on `targetClass` or returns null if such role doesn't exist on the `targetClass`
      • getRoleHandlers

        public static List<RoleHandler> getRoleHandlers​(Class<? extends CtElement> targetClass)
        Parameters:
        targetClass - a Class whose handlers we are looking for
        Returns:
        all RoleHandlers available for the `targetClass`
      • forEachRoleHandler

        public static void forEachRoleHandler​(Consumer<RoleHandler> consumer)
        Parameters:
        consumer - is called for each RoleHandler of SpoonModel
      • getRoleHandlerWrtParent

        public static RoleHandler getRoleHandlerWrtParent​(CtElement element)
        Parameters:
        element - the CtElement whose relation from `element.getParent()` to `element` is needed.
        Returns:
        RoleHandler handling relation from `element.getParent()` to `element`