Package spoon.reflect.meta.impl
Class RoleHandlerHelper
- java.lang.Object
-
- spoon.reflect.meta.impl.RoleHandlerHelper
-
public class RoleHandlerHelper extends Object
Provides aRoleHandler
implementation for the pair ofCtElement
implementation andCtRole
The returnedRoleHandler
can be then used to manipulate value of attribute represented byCtRole
on theCtElement
instance
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
getRoleHandler
public static RoleHandler getRoleHandler(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 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
public static List<RoleHandler> getRoleHandlers(Class<? extends CtElement> targetClass)
- Parameters:
targetClass
- a Class whose handlers we are looking for- Returns:
- all
RoleHandler
s available for the `targetClass`
-
forEachRoleHandler
public static void forEachRoleHandler(Consumer<RoleHandler> consumer)
- Parameters:
consumer
- is called for eachRoleHandler
of SpoonModel
-
getRoleHandlerWrtParent
public static RoleHandler getRoleHandlerWrtParent(CtElement element)
- Parameters:
element
- theCtElement
whose relation from `element.getParent()` to `element` is needed.- Returns:
RoleHandler
handling relation from `element.getParent()` to `element`
-
-