Package spoon.reflect.meta.impl
Class RoleHandlerHelper
java.lang.Object
spoon.reflect.meta.impl.RoleHandlerHelper
Provides a
RoleHandler implementation for the pair of CtElement implementation and CtRole
The returned RoleHandler can be then used to manipulate value of attribute represented by CtRole on the CtElement instance-
Method Summary
Modifier and TypeMethodDescriptionstatic voidforEachRoleHandler(Consumer<RoleHandler> consumer)static RoleHandlergetOptionalRoleHandler(Class<? extends CtElement> targetClass, CtRole role)static RoleHandlergetRoleHandler(Class<? extends CtElement> targetClass, CtRole role)static List<RoleHandler>getRoleHandlers(Class<? extends CtElement> targetClass)static RoleHandlergetRoleHandlerWrtParent(CtElement element)
-
Method Details
-
getRoleHandler
- Parameters:
targetClass- the class of the to be manipulated noderole- defines the to be manipulated attribute- Returns:
RoleHandlerimplementation which knows how to manipulate the attribute ofCtRoleon `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 noderole- defines the to be manipulated attribute- Returns:
RoleHandlerimplementation, which knows how to manipulate the attribute ofCtRoleon `targetClass` or returns null if such role doesn't exist on the `targetClass`
-
getRoleHandlers
- Parameters:
targetClass- a Class whose handlers we are looking for- Returns:
- all
RoleHandlers available for the `targetClass`
-
forEachRoleHandler
- Parameters:
consumer- is called for eachRoleHandlerof SpoonModel
-
getRoleHandlerWrtParent
- Parameters:
element- theCtElementwhose relation from `element.getParent()` to `element` is needed.- Returns:
RoleHandlerhandling relation from `element.getParent()` to `element`
-