Class CpoClass
java.lang.Object
org.synchronoss.cpo.core.meta.bean.CpoClassBean
org.synchronoss.cpo.core.meta.domain.CpoClass
- All Implemented Interfaces:
Serializable,Comparable<CpoClass>,MetaDFVisitable
- Direct Known Subclasses:
CpoClassCaseInsensitive,CpoClassCaseSensitive
public abstract class CpoClass
extends CpoClassBean
implements Comparable<CpoClass>, MetaDFVisitable
Runtime metadata for a JavaBean class mapped by CPO: its
CpoAttributes, keyed both by
Java property name and by datastore column name, and its CpoFunctionGroups (one per named
CRUD operation group). Subclasses (CpoClassCaseSensitive, CpoClassCaseInsensitive) determine how the datastore-name lookup treats case.- Author:
- dberry
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacceptMetaDFVisitor(MetaVisitor visitor) Accepts a visitor, depth-first: this node is visited, then each child accepts the visitor in turn.voidaddAttribute(CpoAttribute cpoAttribute) Adds an attribute to this class, indexing it by both its Java name and its datastore name.abstract voidaddDataNameToMap(String dataName, CpoAttribute cpoAttribute) Adds an attribute to the datastore-name lookup map, using whatever case-sensitivity policy the concrete subclass implements.addFunctionGroup(CpoFunctionGroup group) Adds a function group to this class, keyed by its CRUD type and name.intvoidClears this class's attribute and function group maps, discarding all metadata.booleanexistsFunctionGroup(Crud crud, String groupName) Gets whether a function group exists for the given CRUD type and group name.abstract CpoAttributegetAttributeData(String dataName) Gets the attribute bound to the given datastore-side name.getAttributeJava(String javaName) Gets the attribute bound to the given JavaBean property name.getFunctionGroup(Crud crud, String groupName) Gets the function group for the given CRUD type and group name.Gets all function groups defined on this class, keyed internally by CRUD type and group name.Class<?> Gets the reflectively-resolved Java class this metadata describes, onceloadRunTimeInfo(CpoMetaDescriptor)has been called.voidloadRunTimeInfo(CpoMetaDescriptor metaDescriptor) Resolves this class's reflective metadata (the concrete Java class, and each attribute's getter/setter/transform) against the classpath, if not already resolved.voidremoveAttribute(CpoAttribute cpoAttribute) Removes an attribute from this class's Java-name and datastore-name indexes.abstract voidremoveDataNameFromMap(String dataName) Removes an attribute from the datastore-name lookup map.voidRemoves a function group from this class.toString()Gets the full field-by-field string representation of this class, as produced byCpoClassBean.toString().Methods inherited from class org.synchronoss.cpo.core.meta.bean.CpoClassBean
equals, getDescription, getName, hashCode, setDescription, setName
-
Constructor Details
-
CpoClass
public CpoClass()Creates an empty instance.
-
-
Method Details
-
getMetaClass
Gets the reflectively-resolved Java class this metadata describes, onceloadRunTimeInfo(CpoMetaDescriptor)has been called.- Returns:
- the resolved Java class, or
nullif runtime info has not been loaded
-
addDataNameToMap
Adds an attribute to the datastore-name lookup map, using whatever case-sensitivity policy the concrete subclass implements.- Parameters:
dataName- the datastore-side name to key oncpoAttribute- the attribute to add
-
removeDataNameFromMap
Removes an attribute from the datastore-name lookup map.- Parameters:
dataName- the datastore-side name to remove
-
getAttributeData
Gets the attribute bound to the given datastore-side name.- Parameters:
dataName- the datastore-side name to look up- Returns:
- the matching attribute, or
nullif none is bound todataName
-
addAttribute
Adds an attribute to this class, indexing it by both its Java name and its datastore name. A no-op ifcpoAttributeisnull.- Parameters:
cpoAttribute- the attribute to add
-
removeAttribute
Removes an attribute from this class's Java-name and datastore-name indexes. A no-op ifcpoAttributeisnull.- Parameters:
cpoAttribute- the attribute to remove
-
getFunctionGroups
Gets all function groups defined on this class, keyed internally by CRUD type and group name.- Returns:
- the function groups map
-
getFunctionGroup
Gets the function group for the given CRUD type and group name.- Parameters:
crud- the CRUD operation typegroupName- the function group name- Returns:
- the matching function group
- Throws:
CpoException- if no function group matchescrudandgroupName
-
existsFunctionGroup
Gets whether a function group exists for the given CRUD type and group name.- Parameters:
crud- the CRUD operation typegroupName- the function group name- Returns:
trueif a matching function group exists,falseotherwise- Throws:
CpoException- if the lookup fails
-
addFunctionGroup
Adds a function group to this class, keyed by its CRUD type and name. A no-op (returningnull) ifgroupisnull.- Parameters:
group- the function group to add- Returns:
- the function group previously registered under the same key, or
nullif none
-
removeFunctionGroup
Removes a function group from this class. A no-op ifgroupisnull.- Parameters:
group- the function group to remove
-
compareTo
Orders classes by
CpoClassBean.getName().- Specified by:
compareToin interfaceComparable<CpoClass>
-
acceptMetaDFVisitor
Accepts a visitor, depth-first: this node is visited, then each child accepts the visitor in turn.Visits this class, then its attributes (sorted by Java name), then each function group (sorted by name) together with its functions and each function's arguments, all in their natural/declared order.
- Specified by:
acceptMetaDFVisitorin interfaceMetaDFVisitable- Parameters:
visitor- the visitor to accept
-
loadRunTimeInfo
Resolves this class's reflective metadata (the concrete Java class, and each attribute's getter/setter/transform) against the classpath, if not already resolved. Idempotent and thread-safe; subsequent calls after the first successful resolution are no-ops.- Parameters:
metaDescriptor- the owning descriptor, passed through to each attribute's resolution- Throws:
CpoException- if the class cannot be found, or an attribute cannot be resolved
-
getAttributeJava
Gets the attribute bound to the given JavaBean property name.- Parameters:
javaName- the JavaBean property name to look up- Returns:
- the matching attribute, or
nullifjavaNameisnullor no attribute is bound to it
-
toString
Returns this class's
name.- Overrides:
toStringin classCpoClassBean
-
toStringFull
Gets the full field-by-field string representation of this class, as produced byCpoClassBean.toString().- Returns:
- the full string representation
-
emptyMaps
public void emptyMaps()Clears this class's attribute and function group maps, discarding all metadata.
-