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 void
forEachRoleHandler(Consumer<RoleHandler> consumer)
static RoleHandler
getOptionalRoleHandler(Class<? extends CtElement> targetClass, CtRole role)
static RoleHandler
getRoleHandler(Class<? extends CtElement> targetClass, CtRole role)
static List<RoleHandler>
getRoleHandlers(Class<? extends CtElement> targetClass)
static RoleHandler
getRoleHandlerWrtParent(CtElement element)
-
Method Details
-
getRoleHandler
- Parameters:
targetClass
- the class of the to be manipulated noderole
- defines the to be manipulated attribute- Returns:
RoleHandler
implementation which knows how to manipulate the attribute ofCtRole
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 noderole
- defines the to be manipulated attribute- Returns:
RoleHandler
implementation, which knows how to manipulate the attribute ofCtRole
on `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
RoleHandler
s available for the `targetClass`
-
forEachRoleHandler
- Parameters:
consumer
- is called for eachRoleHandler
of SpoonModel
-
getRoleHandlerWrtParent
- Parameters:
element
- theCtElement
whose relation from `element.getParent()` to `element` is needed.- Returns:
RoleHandler
handling relation from `element.getParent()` to `element`
-