public class EntityBinding extends Object
Include.name()
Constructor and Description |
---|
EntityBinding(EntityDictionary dictionary,
Type<?> cls,
String type)
Constructor
|
EntityBinding(EntityDictionary dictionary,
Type<?> cls,
String type,
String apiVersion,
Set<Class<? extends Annotation>> hiddenAnnotations)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addArgumentsToAttribute(String attribute,
Set<ArgumentType> arguments)
Add a collection of arguments to the attributes of this Entity.
|
void |
addArgumentToEntity(ArgumentType argument)
Add argument to this Entity.
|
void |
bindTrigger(LifeCycleHookBinding.Operation operation,
LifeCycleHookBinding.TransactionPhase phase,
LifeCycleHook hook) |
void |
bindTrigger(LifeCycleHookBinding.Operation operation,
LifeCycleHookBinding.TransactionPhase phase,
String fieldOrMethodName,
LifeCycleHook hook) |
List<AccessibleObject> |
getAllFields()
Get all fields of the entity class, including fields of superclasses (excluding Object).
|
List<AccessibleObject> |
getAllMethods() |
<A extends Annotation> |
getAnnotation(Class<A> annotationClass)
Return annotation from class, parents or package.
|
Set<ArgumentType> |
getAttributeArguments(String attribute)
Returns the Collection of all attributes of an argument.
|
Set<ArgumentType> |
getEntityArguments()
Returns the Collection of all attributes of an Entity.
|
static String |
getFieldName(AccessibleObject fieldOrMethod)
Returns name of field whether public member or method.
|
static Type<?> |
getFieldType(Type<?> parentClass,
AccessibleObject fieldOrMethod)
Returns type of field whether member or method.
|
static Type<?> |
getFieldType(Type<?> parentClass,
AccessibleObject fieldOrMethod,
Optional<Integer> index)
Returns type of field whether member or method.
|
<A extends Annotation> |
getMethodAnnotation(Class<A> annotationClass,
String method)
Return annotation for provided method.
|
Collection<LifeCycleHook> |
getTriggers(LifeCycleHookBinding.Operation op,
LifeCycleHookBinding.TransactionPhase phase) |
Collection<LifeCycleHook> |
getTriggers(LifeCycleHookBinding.Operation op,
LifeCycleHookBinding.TransactionPhase phase,
String fieldName) |
static boolean |
isComputedMethod(Method method)
Check whether or not the provided method described a computed attribute or relationship.
|
static boolean |
isRequestScopeableMethod(Method method)
Check whether or not method expects a RequestScope.
|
public final Type<?> entityClass
public final String jsonApiType
public boolean idGenerated
public final EntityPermissions entityPermissions
public final ConcurrentLinkedDeque<String> attributesDeque
public final ConcurrentLinkedDeque<String> relationshipsDeque
public final ConcurrentHashMap<String,RelationshipType> relationshipTypes
public final ConcurrentHashMap<String,String> relationshipToInverse
public final ConcurrentHashMap<String,javax.persistence.CascadeType[]> relationshipToCascadeTypes
public final ConcurrentHashMap<String,AccessibleObject> fieldsToValues
public final org.apache.commons.collections4.MultiValuedMap<org.apache.commons.lang3.tuple.Triple<String,LifeCycleHookBinding.Operation,LifeCycleHookBinding.TransactionPhase>,LifeCycleHook> fieldTriggers
public final org.apache.commons.collections4.MultiValuedMap<org.apache.commons.lang3.tuple.Pair<LifeCycleHookBinding.Operation,LifeCycleHookBinding.TransactionPhase>,LifeCycleHook> classTriggers
public final ConcurrentHashMap<String,Type<?>> fieldsToTypes
public final ConcurrentHashMap<String,String> aliasesToFields
public final ConcurrentHashMap<Method,Boolean> requestScopeableMethods
public final ConcurrentHashMap<AccessibleObject,Set<ArgumentType>> attributeArguments
public final ConcurrentHashMap<String,ArgumentType> entityArguments
public final ConcurrentHashMap<Object,Annotation> annotations
public static final EntityBinding EMPTY_BINDING
public static final Set<ArgumentType> EMPTY_ATTRIBUTES_ARGS
public EntityBinding(EntityDictionary dictionary, Type<?> cls, String type)
dictionary
- Dictionary to usecls
- Entity classtype
- Declared Elide type namepublic EntityBinding(EntityDictionary dictionary, Type<?> cls, String type, String apiVersion, Set<Class<? extends Annotation>> hiddenAnnotations)
dictionary
- Dictionary to usecls
- Entity classtype
- Declared Elide type namehiddenAnnotations
- Annotations for hiding a field in APIpublic List<AccessibleObject> getAllFields()
public List<AccessibleObject> getAllMethods()
public static String getFieldName(AccessibleObject fieldOrMethod)
fieldOrMethod
- field or methodpublic static boolean isRequestScopeableMethod(Method method)
method
- Method to checkpublic static boolean isComputedMethod(Method method)
method
- Method to checkpublic static Type<?> getFieldType(Type<?> parentClass, AccessibleObject fieldOrMethod)
parentClass
- The class which owns the given field or methodfieldOrMethod
- field or methodpublic static Type<?> getFieldType(Type<?> parentClass, AccessibleObject fieldOrMethod, Optional<Integer> index)
parentClass
- The class which owns the given field or methodfieldOrMethod
- field or methodindex
- Optional parameter index for parameterized types that take one or more parameters. If
an index is provided, the type returned is the parameter type. Otherwise it is the
parameterized type.public void bindTrigger(LifeCycleHookBinding.Operation operation, LifeCycleHookBinding.TransactionPhase phase, String fieldOrMethodName, LifeCycleHook hook)
public void bindTrigger(LifeCycleHookBinding.Operation operation, LifeCycleHookBinding.TransactionPhase phase, LifeCycleHook hook)
public Collection<LifeCycleHook> getTriggers(LifeCycleHookBinding.Operation op, LifeCycleHookBinding.TransactionPhase phase, String fieldName)
public Collection<LifeCycleHook> getTriggers(LifeCycleHookBinding.Operation op, LifeCycleHookBinding.TransactionPhase phase)
public <A extends Annotation> A getAnnotation(Class<A> annotationClass)
A
- annotation typeannotationClass
- the annotation classpublic <A extends Annotation> A getMethodAnnotation(Class<A> annotationClass, String method)
A
- annotation typeannotationClass
- the annotation classmethod
- the methodpublic void addArgumentsToAttribute(String attribute, Set<ArgumentType> arguments)
attribute
- attribute name to which argument has to be addedarguments
- Set of Argument Type for the attributepublic Set<ArgumentType> getAttributeArguments(String attribute)
attribute
- Name of the argument for ehich arguments are to be retrieved.public void addArgumentToEntity(ArgumentType argument)
argument
- Argument Type for the attributepublic Set<ArgumentType> getEntityArguments()
Copyright © 2015–2021 Yahoo! Inc.. All rights reserved.