Package org.datanucleus.metadata
Class AbstractClassMetaData
- java.lang.Object
-
- org.datanucleus.metadata.MetaData
-
- org.datanucleus.metadata.AbstractClassMetaData
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClassMetaData
,InterfaceMetaData
public abstract class AbstractClassMetaData extends MetaData
Abstract representation of the MetaData of a class/interface. Has a parent PackageMetaData that can contain the metadata for several classes/interfaces. Is extended by ClassMetaData and InterfaceMetaData. Of the things that it contains the main ones are the "members" which are the MetaData for all fields and properties that are persistable.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Boolean
accessViaField
Whether the class has been explicitly marked as using FIELD access (JPA).protected int[]
allMemberPositions
Positions of all fields/properties (inc superclasses).protected Boolean
cacheable
cacheable tag value.protected String
catalog
Catalog name (O/R mapping).protected boolean
detachable
detachable tag value.protected boolean[]
dfgMemberFlags
Flags of the default-fetch-group state for all fields/properties.protected int[]
dfgMemberPositions
Positions of the default-fetch-group fields/properties (inc superclasses).protected boolean
embeddedOnly
embedded-only tag value.protected String
entityName
Entity name.protected Boolean
excludeDefaultListeners
Flag to exclude default listeners.protected Boolean
excludeSuperClassListeners
Flag to exclude superclass listeners.protected Map<String,FetchGroupMetaData>
fetchGroupMetaDataByName
Convenience lookup map of fetch group by the name.protected Boolean
fetchGroupMetaWithPostLoad
Cached result ofhasFetchGroupWithPostLoad()
protected Set<FetchGroupMetaData>
fetchGroups
protected List<ForeignKeyMetaData>
foreignKeys
List of foreign-keysprotected String
fullName
Full name (e.g org.datanucleus.MyClass)static String
GENERATED_PK_SUFFIX
Suffix to add on to the class name for any generated primary key class.protected Boolean
hasRelations
Cached result ofhasRelations(ClassLoaderResolver)
protected IdentityMetaData
identityMetaData
Identity MetaDataprotected boolean
identitySpecified
Flag whether the identity was specified by the user.protected IdentityType
identityType
Identity-type tag value.protected boolean
implementationOfPersistentDefinition
protected List<IndexMetaData>
indexes
List of indexesprotected InheritanceMetaData
inheritanceMetaData
Inheritance MetaDataprotected boolean
instantiable
Whether the class is fully defined, and hence instantiable.protected List<JoinMetaData>
joins
List of joinsprotected List<EventListenerMetaData>
listeners
EventListeners.protected AbstractMemberMetaData[]
managedMembers
Managed fields/properties of this class.protected boolean
mappedSuperclass
Whether this class is explicitly marked as MappedSuperclass.protected int
memberCount
number of managed fields/properties from this class plus inherited classes.protected Map<String,Integer>
memberPositionsByName
Position numbers of members mapped by the name of the field/property.protected List<AbstractMemberMetaData>
members
List of all members (fields/properties).protected boolean
metaDataComplete
Flag for whether the MetaData here is complete without annotations.protected MetaDataManager
mmgr
Manager for this metadata.protected String
name
Class nameprotected boolean[]
nonPkMemberFlags
Flags of the non-primary key fields/properties (inc superclasses).protected int[]
nonPkMemberPositions
Positions of the non-primary-key fields/properties (inc superclasses).protected int
noOfInheritedManagedMembers
No of managed fields/properties in superclasses, that are inherited by this class.protected String
objectidClass
objectid-class tag value.protected AbstractMemberMetaData[]
overriddenMembers
Fields/properties for superclasses that are overridden in this class.protected AbstractClassMetaData
pcSuperclassMetaData
Class MetaData for the persistable superclass (if any)protected String
persistableSuperclass
persistable-superclass tag value (deprecated).protected ClassPersistenceModifier
persistenceModifier
persistence-modifier tag value.protected boolean
persistentInterfaceImplNeedingTableFromSubclass
Implementation of "persistent-interface" needing table setting from subclass.protected boolean
persistentInterfaceImplNeedingTableFromSuperclass
Implementation of "persistent-interface" needing table setting from superclass.protected Boolean
pkIsDatastoreAttributed
Cached result ofpkIsDatastoreAttributed(StoreManager)
protected int[]
pkMemberPositions
Positions of the primary-key fields/properties (inc superclasses).protected PrimaryKeyMetaData
primaryKeyMetaData
PrimaryKey MetaDataprotected Collection<QueryMetaData>
queries
Named queriesprotected Collection<QueryResultMetaData>
queryResultMetaData
List of query result MetaData defined for this file.protected int[]
relationPositions
Absolute positions of the fields/properties that have relations.protected boolean
requiresExtent
requires-extent tag value.protected String
schema
Schema name (O/R mapping).protected boolean[]
scoMutableMemberFlags
Flags of the SCO mutable state for all fields/properties.protected int[]
scoMutableMemberPositions
Positions of the SCO mutable fields/properties (inc superclasses).protected int[]
scoNonContainerMemberPositions
Absolute positions of all SCO fields/properties that aren't containers.protected int[]
secondClassContainerMemberPositions
Positions of all SCO fields/properties that are containers.protected boolean
serializeRead
Whether to lock objects of this type on read operations.protected Collection<StoredProcQueryMetaData>
storedProcQueries
Named stored procsprotected String
table
Table name (O/R mapping).protected List<UniqueMetaData>
uniqueConstraints
List of uniqueConstraintsprotected List<ColumnMetaData>
unmappedColumns
The columns that are present in the datastore yet not mapped to fields in this class.protected boolean
usesSingleFieldIdentityClass
if this persistable class uses SingleFieldIdentityprotected VersionMetaData
versionMetaData
Version MetaData-
Fields inherited from class org.datanucleus.metadata.MetaData
EXTENSION_CLASS_CREATETIMESTAMP, EXTENSION_CLASS_CREATETIMESTAMP_COLUMN_NAME, EXTENSION_CLASS_CREATEUSER, EXTENSION_CLASS_CREATEUSER_COLUMN_LENGTH, EXTENSION_CLASS_CREATEUSER_COLUMN_NAME, EXTENSION_CLASS_MULTITENANCY_COLUMN_LENGTH, EXTENSION_CLASS_MULTITENANCY_COLUMN_NAME, EXTENSION_CLASS_MULTITENANCY_DISABLE, EXTENSION_CLASS_MULTITENANCY_JDBC_TYPE, EXTENSION_CLASS_READ_ONLY, EXTENSION_CLASS_SOFTDELETE, EXTENSION_CLASS_SOFTDELETE_COLUMN_NAME, EXTENSION_CLASS_UPDATETIMESTAMP, EXTENSION_CLASS_UPDATETIMESTAMP_COLUMN_NAME, EXTENSION_CLASS_UPDATEUSER, EXTENSION_CLASS_UPDATEUSER_COLUMN_LENGTH, EXTENSION_CLASS_UPDATEUSER_COLUMN_NAME, EXTENSION_CLASS_VERSION_FIELD_NAME, EXTENSION_CLASS_VIEW_DEFINITION, EXTENSION_CLASS_VIEW_IMPORTS, EXTENSION_MEMBER_CACHEABLE, EXTENSION_MEMBER_CALENDAR_ONE_COLUMN, EXTENSION_MEMBER_CASCADE_DETACH, EXTENSION_MEMBER_CASCADE_PERSIST, EXTENSION_MEMBER_CASCADE_REFRESH, EXTENSION_MEMBER_CASCADE_UPDATE, EXTENSION_MEMBER_COMPARATOR_NAME, EXTENSION_MEMBER_CONTAINER_ALLOW_NULLS, EXTENSION_MEMBER_ENUM_GETTER_BY_VALUE, EXTENSION_MEMBER_ENUM_VALUE_GETTER, EXTENSION_MEMBER_FETCH_FK_ONLY, EXTENSION_MEMBER_IMPLEMENTATION_CLASSES, EXTENSION_MEMBER_INSERTABLE, EXTENSION_MEMBER_KEY_IMPLEMENTATION_CLASSES, EXTENSION_MEMBER_LIST_ORDERING, EXTENSION_MEMBER_RELATION_DISCRIM_COLUMN, EXTENSION_MEMBER_RELATION_DISCRIM_PK, EXTENSION_MEMBER_RELATION_DISCRIM_VALUE, EXTENSION_MEMBER_STRATEGY_WHEN_NOTNULL, EXTENSION_MEMBER_TYPE_CONVERTER_DISABLED, EXTENSION_MEMBER_TYPE_CONVERTER_NAME, EXTENSION_MEMBER_UPDATEABLE, EXTENSION_MEMBER_VALUE_IMPLEMENTATION_CLASSES, EXTENSION_VERSION_NUMBER_INITIAL_VALUE, extensions, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractClassMetaData(ClassMetaData cmd, String implClassName)
Constructor for creating the ClassMetaData for an implementation of a "persistent-abstract-class".AbstractClassMetaData(InterfaceMetaData imd, String implClassName, boolean copyMembers)
Constructor for creating the ClassMetaData for an implementation of a "persistent-interface".protected
AbstractClassMetaData(PackageMetaData parent, String name)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addFetchGroup(FetchGroupMetaData fgmd)
Method to add a fetch-group to this class.void
addForeignKey(ForeignKeyMetaData fkmd)
Method to add an foreign-key to this class.void
addIndex(IndexMetaData idxmd)
Method to add an index to this class.void
addJoin(JoinMetaData jnmd)
Method to add a join to this class.void
addListener(EventListenerMetaData listener)
Add a listener class namevoid
addMember(AbstractMemberMetaData mmd)
Method to add a field/property to this interface.void
addQuery(QueryMetaData qmd)
Method to add a named query to this class.void
addQueryResultMetaData(QueryResultMetaData resultMetaData)
Method to register a query-result MetaData.void
addStoredProcQuery(StoredProcQueryMetaData qmd)
Method to add a named stored proc query to this class.void
addUniqueConstraint(UniqueMetaData unimd)
Method to add a unique constraint to this class.void
addUnmappedColumn(ColumnMetaData colmd)
Method to add an unmapped column.protected void
applyDefaultDiscriminatorValueWhenNotSpecified()
protected static void
checkForCircularViewReferences(Map<String,Set<String>> viewReferences, String referencerName, String referenceeName, List<String> referenceChain)
Check for any circular view references between referencer and referencee.protected void
checkInitialised()
Method to check whether the Meta-Data has been initialised.protected void
checkNotYetPopulated()
Method to check that the Meta-Data has not been populated yet.protected void
checkPopulated()
Method to check whether the Meta-Data has been populated.protected void
determineIdentity()
Determines the identity based on MetaData defaults or user defined MetaDataprotected void
determineInheritanceMetaData()
Impose a default inheritance strategy when one is not already specified.protected void
determineObjectIdClass()
Determine the object id class.protected void
determineSuperClassName(ClassLoaderResolver clr, Class cls)
Determine the nearest superclass that is persistable (if any).void
excludeDefaultListeners()
Method to exclude default listeners.void
excludeSuperClassListeners()
Toogle exclude super class listenersint
getAbsolutePositionOfMember(String memberName)
Accessor for the absolute position of the field/property with the specified name.Boolean
getAccessViaField()
int[]
getAllMemberPositions()
Accessor for all field/property positions.AbstractClassMetaData
getBaseAbstractClassMetaData()
Convenience accessor for the AbstractClassMetaData of the base object in this hierarchy.IdentityMetaData
getBaseIdentityMetaData()
Convenience method to return the root identity metadata for this inheritance tree.protected String
getBaseInheritanceStrategy()
int[]
getBasicMemberPositions(ClassLoaderResolver clr)
Accessor for the absolute positions of fields/properties that are considered basic.int[]
getBidirectionalRelationMemberPositions(ClassLoaderResolver clr)
Convenience method to return the absolute positions of fields/properties that have bidirectional relations.String
getCatalog()
boolean[]
getDFGMemberFlags()
Accessor for the flags of the DFG fields/properties (inc superclass).int[]
getDFGMemberPositions()
Accessor for the absolute positions of the default fetch group fields/properties (inc superclasses).ColumnMetaData
getDiscriminatorColumnMetaData()
Return the metadata for the discriminator column if defined in metadata.String
getDiscriminatorColumnName()
Return the name of the discriminator column if defined in metadata.DiscriminatorMetaData
getDiscriminatorMetaData()
Convenience accessor for the discriminator metadata applying to this class.DiscriminatorMetaData
getDiscriminatorMetaDataForTable()
Convenience method to find the discriminator MetaData defining the discrim for the same table as this class is using.DiscriminatorMetaData
getDiscriminatorMetaDataRoot()
Convenience method to return the "root" discriminator metadata definition (that defines the strategy, column etc).DiscriminatorStrategy
getDiscriminatorStrategy()
Method to return the discriminator strategy being used by this class.DiscriminatorStrategy
getDiscriminatorStrategyForTable()
Convenience accessor for the discriminator strategy applying to this class.Object
getDiscriminatorValue()
Method returning the discriminator value to apply to an instance of this class.String
getEntityName()
Set<FetchGroupMetaData>
getFetchGroupMetaData()
Accessor for all MetaData defined for fetch groups for this class.FetchGroupMetaData
getFetchGroupMetaData(String groupname)
Accessor for the fetch group metadata for the group specified.Set<FetchGroupMetaData>
getFetchGroupMetaData(Collection<String> groupNames)
Accessor for fetch group metadata for the specified groups (if present).List<ForeignKeyMetaData>
getForeignKeyMetaData()
String
getFullClassName()
Accessor for the full class name including any package name.IdentityMetaData
getIdentityMetaData()
Accessor for identityMetaDataIdentityType
getIdentityType()
List<IndexMetaData>
getIndexMetaData()
InheritanceMetaData
getInheritanceMetaData()
Accessor for inheritanceMetaDataList<JoinMetaData>
getJoinMetaData()
EventListenerMetaData
getListenerForClass(String className)
Accessor for the EventListener info for an EventListener class nameList<EventListenerMetaData>
getListeners()
Get the event listenersAbstractMemberMetaData[]
getManagedMembers()
Accessor for the managed fields/properties in this class (not including superclass, but including overridden).protected AbstractMemberMetaData
getMemberBeingOverridden(String name)
Convenience method that navigates up a MetaData inheritance tree until it finds the base member definition for the specified name.int
getMemberCount()
Accessor for the number of managed members from this class plus inherited classes.AbstractMemberMetaData
getMetaDataForManagedMemberAtAbsolutePosition(int position)
Accessor for a managed member including superclass members.protected AbstractMemberMetaData
getMetaDataForManagedMemberAtAbsolutePositionInternal(int abs_position)
Internal method to get the field/property for an absolute field number.AbstractMemberMetaData
getMetaDataForManagedMemberAtRelativePosition(int position)
Accessor for MetaData for a managed member in this class.AbstractMemberMetaData
getMetaDataForMember(String name)
Accessor for the Meta-Data for a member.AbstractMemberMetaData
getMetaDataForMemberAtRelativePosition(int index)
Accessor for the metadata of a member.MetaDataManager
getMetaDataManager()
int[]
getMultivaluedMemberPositions()
Accessor for the absolute positions of fields/properties that are considered multi-valued This category includes members of all multi-valued types, including Collection, array, and Map types of basic and relationship types.String
getName()
Accessor for the simple class name (without package name).boolean[]
getNonPKMemberFlags()
Accessor for the flags of the non primary key fields/properties (inc superclass members).int[]
getNonPKMemberPositions()
Accessor for the positions of the non primary key fields/properties (inc superclass fields).int[]
getNonRelationMemberPositions(ClassLoaderResolver clr)
int
getNoOfInheritedManagedMembers()
Accessor for the number of inherited managed members in superclasses.int
getNoOfManagedMembers()
Accessor for the number of managed members (this class only).int
getNoOfMembers()
Accessor for the number of members defined for this class (including overrides).int
getNoOfPrimaryKeyMembers()
Accessor for the number of primary key fields/properties.int
getNoOfQueries()
Accessor for the number of named queries.int
getNoOfStoredProcQueries()
Accessor for the number of named stored proc queries.String
getObjectidClass()
AbstractMemberMetaData
getOverriddenMember(String name)
Accessor for an overridden field/property with the specified name.AbstractMemberMetaData[]
getOverriddenMembers()
Accessor for the overridden fields/properties in this class.PackageMetaData
getPackageMetaData()
String
getPackageName()
String
getPersistableSuperclass()
ClassPersistenceModifier
getPersistenceModifier()
int[]
getPKMemberPositions()
Accessor for the field numbers of the primary key fields/properties.String[]
getPrimaryKeyMemberNames()
Accessor for the names of the primary key fields/properties.PrimaryKeyMetaData
getPrimaryKeyMetaData()
Accessor for primaryKeyMetaDataQueryMetaData[]
getQueries()
Accessor for the metadata of the named queries.QueryResultMetaData[]
getQueryResultMetaData()
Get the query result MetaData registered for this class.int[]
getRelationMemberPositions(ClassLoaderResolver clr)
Convenience method to return the absolute positions of all fields/properties that have relations.int
getRelativePositionOfMember(String memberName)
Accessor for the (relative) position of the field/property with the specified name.protected AbstractClassMetaData
getRootInstantiableClass()
String
getSchema()
int[]
getSCOContainerMemberPositions()
Accessor for the absolute positions of all SCO fields/properties that are containers.boolean[]
getSCOMutableMemberFlags()
Accessor for the flags of the SCO mutable fields (inc superclass fields).int[]
getSCOMutableMemberPositions()
Accessor for the absolute positions of the second class mutable fields/properties.int[]
getSCONonContainerMemberPositions()
Accessor for the absolute positions of all SCO fields/properties that are NOT containers (e.g Dates, Points, etc)StoredProcQueryMetaData[]
getStoredProcQueries()
Accessor for the metadata of the named stored proc queries.AbstractClassMetaData
getSuperAbstractClassMetaData()
Accessor for the Meta-Data for the superclass of this class.String
getTable()
List<UniqueMetaData>
getUniqueMetaData()
List<ColumnMetaData>
getUnmappedColumns()
Accessor for the unmapped columns required for the datastore table.VersionMetaData
getVersionMetaData()
Accessor for Version MetaData for this class specifically.VersionMetaData
getVersionMetaDataForClass()
Convenience accessor for the version metadata applying to this class.VersionMetaData
getVersionMetaDataForTable()
Convenience method to find the version MetaData defining versioning for the same 'table' as this class is using.boolean
hasDiscriminatorStrategy()
Accessor for whether we have a discriminator defined for this class (may be in superclasses).boolean
hasFetchGroupWithPostLoad()
Whether this class or any super class has any fetch group definition withFetchGroupMetaData.getPostLoad()
==true.boolean
hasMember(String memberName)
Method to check if a member exists in this classes definition.boolean
hasRelations(ClassLoaderResolver clr)
Convenience method to return if the class has relations to other objects.protected void
inheritIdentity()
Inherit the identity definition from super classes.protected void
initialiseMemberPositionInformation()
Method to initialise all convenience information about member positions and what role each position performs.Boolean
isCacheable()
boolean
isDescendantOf(AbstractClassMetaData cmd)
Convenience method to return if this class is a descendant of the supplied class metadata.boolean
isDetachable()
boolean
isEmbeddedOnly()
boolean
isExcludeDefaultListeners()
Whether default listeners are not going to be invokedboolean
isExcludeSuperClassListeners()
Whether super classes listeners are not going to be invokedboolean
isImplementationOfPersistentDefinition()
Return whether this MetaData is for an implementation of a persistent definition.boolean
isInstantiable()
boolean
isMappedSuperclass()
boolean
isMetaDataComplete()
Accessor for whether this class is fully specified by this metadata and that any annotations should be ignored.boolean
isRequiresExtent()
boolean
isRootInstantiableClass()
boolean
isSameOrAncestorOf(AbstractClassMetaData cmd)
Check if the argument cmd is the same as this or a descedent.boolean
isSerializeRead()
boolean
isVersioned()
Returns whether objects of this type are versioned.protected Class
loadClass(ClassLoaderResolver clr, ClassLoader primary)
Load the persistent interface/classprotected AbstractMemberMetaData
newDefaultedProperty(String name)
Utility to add a defaulted PropertyMetaData to the class.FetchGroupMetaData
newFetchGroupMetaData(String name)
Method to create a new fetchgroup metadata, add it, and return it.FieldMetaData
newFieldMetadata(String fieldName)
Method to create a new field metadata, add it, and return it.ForeignKeyMetaData
newForeignKeyMetadata()
Method to create a new FK metadata, add it, and return it.IdentityMetaData
newIdentityMetadata()
Method to create a new identity metadata, set to use it, and return it.IndexMetaData
newIndexMetadata()
Method to create a new index metadata, add it, and return it.InheritanceMetaData
newInheritanceMetadata()
Method to create a new inheritance metadata, set to use it, and return it.JoinMetaData
newJoinMetaData()
Method to create a new join metadata, add it, and return it.PrimaryKeyMetaData
newPrimaryKeyMetadata()
Method to create a new primary key metadata, set to use it, and return it.PropertyMetaData
newPropertyMetadata(String propName)
Method to create a new property metadata, add it, and return it.QueryMetaData
newQueryMetadata(String queryName)
Method to create a new QueryMetadata, add it to the registered queries and return it.StoredProcQueryMetaData
newStoredProcQueryMetadata(String queryName)
Method to create a new StoredProcQueryMetadata, add it to the registered queries and return it.UniqueMetaData
newUniqueMetadata()
Method to create a new unique metadata, add it, and return it.ColumnMetaData
newUnmappedColumnMetaData()
VersionMetaData
newVersionMetadata()
Method to create a new version metadata, set to use it, and return it.boolean
pkIsDatastoreAttributed(StoreManager storeMgr)
Convenience method to calculate and return if the pk has some component that is generated in the datastore.abstract void
populate(ClassLoaderResolver clr, ClassLoader primary, MetaDataManager mmgr)
Method to provide the details of the class being represented by this MetaData.void
setAccessViaField(boolean flag)
AbstractClassMetaData
setCacheable(boolean cache)
AbstractClassMetaData
setCacheable(String cache)
AbstractClassMetaData
setCatalog(String catalog)
AbstractClassMetaData
setDetachable(boolean flag)
AbstractClassMetaData
setDetachable(String flag)
AbstractClassMetaData
setEmbeddedOnly(boolean flag)
AbstractClassMetaData
setEmbeddedOnly(String flag)
AbstractClassMetaData
setEntityName(String name)
void
setIdentityMetaData(IdentityMetaData identityMetaData)
Mutator for the identity MetaData.void
setIdentityType(IdentityType type)
void
setInheritanceMetaData(InheritanceMetaData inheritanceMetaData)
Mutator for the inheritance MetaData.void
setMappedSuperclass(boolean mapped)
void
setMetaDataComplete()
Method to set that this class is "metadata complete" (see JPA spec).AbstractClassMetaData
setObjectIdClass(String objectidClass)
AbstractClassMetaData
setPersistenceModifier(ClassPersistenceModifier modifier)
void
setPrimaryKeyMetaData(PrimaryKeyMetaData primaryKeyMetaData)
Mutator for the PrimaryKey MetaData.AbstractClassMetaData
setRequiresExtent(boolean flag)
AbstractClassMetaData
setRequiresExtent(String flag)
AbstractClassMetaData
setSchema(String schema)
void
setSerializeRead(boolean serialise)
AbstractClassMetaData
setTable(String table)
void
setVersionMetaData(VersionMetaData versionMetaData)
Mutator for the Version MetaData.boolean
usesSingleFieldIdentityClass()
Whether this persistable class uses SingleFieldIdentityprotected void
validateObjectIdClass(ClassLoaderResolver clr)
Validate the objectid-class of this class.protected void
validateUnmappedColumns()
Convenience method to validate the specified "unmapped" columns.protected void
validateUserInputForIdentity()
Check for conflicts on super class and this class MetaData identityprotected void
validateUserInputForInheritanceMetaData(boolean isAbstract)
Check if the inheritance MetaData is credible.-
Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtensions, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, removeExtension, setExtensions, setParent
-
-
-
-
Field Detail
-
GENERATED_PK_SUFFIX
public static final String GENERATED_PK_SUFFIX
Suffix to add on to the class name for any generated primary key class.- See Also:
- Constant Field Values
-
mmgr
protected transient MetaDataManager mmgr
Manager for this metadata. Set at populate.
-
name
protected final String name
Class name
-
entityName
protected String entityName
Entity name. Required by JPA $4.3.1 for accessing this class in queries.
-
mappedSuperclass
protected boolean mappedSuperclass
Whether this class is explicitly marked as MappedSuperclass. Will be false when using JDO.
-
instantiable
protected boolean instantiable
Whether the class is fully defined, and hence instantiable. This is false when it is a JPA MappedSuperclass and has no PK fields defined (will be defined in the derived Entity). This is different to whether the class is abstract - use ClassMetaData.isAbstract() for that.
-
accessViaField
protected Boolean accessViaField
Whether the class has been explicitly marked as using FIELD access (JPA).
-
identityType
protected IdentityType identityType
Identity-type tag value.
-
persistenceModifier
protected ClassPersistenceModifier persistenceModifier
persistence-modifier tag value.
-
persistableSuperclass
protected String persistableSuperclass
persistable-superclass tag value (deprecated).
-
objectidClass
protected String objectidClass
objectid-class tag value.
-
requiresExtent
protected boolean requiresExtent
requires-extent tag value.
-
detachable
protected boolean detachable
detachable tag value.
-
embeddedOnly
protected boolean embeddedOnly
embedded-only tag value.
-
catalog
protected String catalog
Catalog name (O/R mapping).
-
schema
protected String schema
Schema name (O/R mapping).
-
table
protected String table
Table name (O/R mapping). This may be of the form "[database].[catalog].[schema].table"
-
cacheable
protected Boolean cacheable
cacheable tag value.
-
fullName
protected final String fullName
Full name (e.g org.datanucleus.MyClass)
-
versionMetaData
protected VersionMetaData versionMetaData
Version MetaData
-
identityMetaData
protected IdentityMetaData identityMetaData
Identity MetaData
-
identitySpecified
protected boolean identitySpecified
Flag whether the identity was specified by the user.
-
inheritanceMetaData
protected InheritanceMetaData inheritanceMetaData
Inheritance MetaData
-
primaryKeyMetaData
protected PrimaryKeyMetaData primaryKeyMetaData
PrimaryKey MetaData
-
listeners
protected List<EventListenerMetaData> listeners
EventListeners. Use a list to preserve ordering.
-
excludeSuperClassListeners
protected Boolean excludeSuperClassListeners
Flag to exclude superclass listeners.
-
excludeDefaultListeners
protected Boolean excludeDefaultListeners
Flag to exclude default listeners.
-
fetchGroupMetaDataByName
protected Map<String,FetchGroupMetaData> fetchGroupMetaDataByName
Convenience lookup map of fetch group by the name.
-
pcSuperclassMetaData
protected AbstractClassMetaData pcSuperclassMetaData
Class MetaData for the persistable superclass (if any)
-
metaDataComplete
protected boolean metaDataComplete
Flag for whether the MetaData here is complete without annotations. Used by JPA.
-
serializeRead
protected boolean serializeRead
Whether to lock objects of this type on read operations.
-
queries
protected Collection<QueryMetaData> queries
Named queries
-
storedProcQueries
protected Collection<StoredProcQueryMetaData> storedProcQueries
Named stored procs
-
queryResultMetaData
protected Collection<QueryResultMetaData> queryResultMetaData
List of query result MetaData defined for this file.
-
unmappedColumns
protected List<ColumnMetaData> unmappedColumns
The columns that are present in the datastore yet not mapped to fields in this class.
-
fetchGroups
protected Set<FetchGroupMetaData> fetchGroups
-
foreignKeys
protected List<ForeignKeyMetaData> foreignKeys
List of foreign-keys
-
indexes
protected List<IndexMetaData> indexes
List of indexes
-
uniqueConstraints
protected List<UniqueMetaData> uniqueConstraints
List of uniqueConstraints
-
joins
protected List<JoinMetaData> joins
List of joins
-
members
protected List<AbstractMemberMetaData> members
List of all members (fields/properties).
-
managedMembers
protected AbstractMemberMetaData[] managedMembers
Managed fields/properties of this class. Subset of the AbstractMemberMetaData objects that are in "members", excluding "overriddenMembers".
-
overriddenMembers
protected AbstractMemberMetaData[] overriddenMembers
Fields/properties for superclasses that are overridden in this class.
-
memberPositionsByName
protected Map<String,Integer> memberPositionsByName
Position numbers of members mapped by the name of the field/property.
-
allMemberPositions
protected int[] allMemberPositions
Positions of all fields/properties (inc superclasses).
-
pkMemberPositions
protected int[] pkMemberPositions
Positions of the primary-key fields/properties (inc superclasses).
-
nonPkMemberPositions
protected int[] nonPkMemberPositions
Positions of the non-primary-key fields/properties (inc superclasses).
-
nonPkMemberFlags
protected boolean[] nonPkMemberFlags
Flags of the non-primary key fields/properties (inc superclasses).
-
dfgMemberPositions
protected int[] dfgMemberPositions
Positions of the default-fetch-group fields/properties (inc superclasses).
-
dfgMemberFlags
protected boolean[] dfgMemberFlags
Flags of the default-fetch-group state for all fields/properties.
-
scoMutableMemberPositions
protected int[] scoMutableMemberPositions
Positions of the SCO mutable fields/properties (inc superclasses).
-
scoMutableMemberFlags
protected boolean[] scoMutableMemberFlags
Flags of the SCO mutable state for all fields/properties.
-
scoNonContainerMemberPositions
protected int[] scoNonContainerMemberPositions
Absolute positions of all SCO fields/properties that aren't containers.
-
relationPositions
protected int[] relationPositions
Absolute positions of the fields/properties that have relations.
-
noOfInheritedManagedMembers
protected int noOfInheritedManagedMembers
No of managed fields/properties in superclasses, that are inherited by this class.
-
usesSingleFieldIdentityClass
protected boolean usesSingleFieldIdentityClass
if this persistable class uses SingleFieldIdentity
-
memberCount
protected int memberCount
number of managed fields/properties from this class plus inherited classes.
-
implementationOfPersistentDefinition
protected boolean implementationOfPersistentDefinition
-
fetchGroupMetaWithPostLoad
protected Boolean fetchGroupMetaWithPostLoad
Cached result ofhasFetchGroupWithPostLoad()
-
pkIsDatastoreAttributed
protected Boolean pkIsDatastoreAttributed
Cached result ofpkIsDatastoreAttributed(StoreManager)
-
hasRelations
protected Boolean hasRelations
Cached result ofhasRelations(ClassLoaderResolver)
-
persistentInterfaceImplNeedingTableFromSuperclass
protected transient boolean persistentInterfaceImplNeedingTableFromSuperclass
Implementation of "persistent-interface" needing table setting from superclass.
-
persistentInterfaceImplNeedingTableFromSubclass
protected transient boolean persistentInterfaceImplNeedingTableFromSubclass
Implementation of "persistent-interface" needing table setting from subclass.
-
secondClassContainerMemberPositions
protected int[] secondClassContainerMemberPositions
Positions of all SCO fields/properties that are containers.
-
-
Constructor Detail
-
AbstractClassMetaData
protected AbstractClassMetaData(PackageMetaData parent, String name)
Constructor. Set fields using setters, before populate().- Parameters:
parent
- The package to which this class/interface belongsname
- (Simple) name of class (omitting the package name)
-
AbstractClassMetaData
public AbstractClassMetaData(InterfaceMetaData imd, String implClassName, boolean copyMembers)
Constructor for creating the ClassMetaData for an implementation of a "persistent-interface".- Parameters:
imd
- MetaData for the "persistent-interface"implClassName
- Name of the implementation classcopyMembers
- Whether to copy the fields/properties of the interface too
-
AbstractClassMetaData
public AbstractClassMetaData(ClassMetaData cmd, String implClassName)
Constructor for creating the ClassMetaData for an implementation of a "persistent-abstract-class".- Parameters:
cmd
- MetaData for the implementation of the "persistent-abstract-class"implClassName
- Name of the implementation class
-
-
Method Detail
-
getMetaDataManager
public MetaDataManager getMetaDataManager()
- Overrides:
getMetaDataManager
in classMetaData
-
isInstantiable
public boolean isInstantiable()
-
getRootInstantiableClass
protected AbstractClassMetaData getRootInstantiableClass()
-
isRootInstantiableClass
public boolean isRootInstantiableClass()
-
isImplementationOfPersistentDefinition
public boolean isImplementationOfPersistentDefinition()
Return whether this MetaData is for an implementation of a persistent definition. This could be an implementation of a persistent interface or a persistent abstract-class.- Returns:
- Whether this is an implementation
-
checkInitialised
protected void checkInitialised()
Method to check whether the Meta-Data has been initialised.- Throws:
NucleusException
- Thrown if the Meta-Data hasn't been initialised.
-
checkPopulated
protected void checkPopulated()
Method to check whether the Meta-Data has been populated.- Throws:
NucleusException
- Thrown if the Meta-Data hasn't been populated.
-
checkNotYetPopulated
protected void checkNotYetPopulated()
Method to check that the Meta-Data has not been populated yet.- Throws:
NucleusUserException
- Thrown if the Meta-Data has already been populated.
-
loadClass
protected Class loadClass(ClassLoaderResolver clr, ClassLoader primary)
Load the persistent interface/class- Parameters:
clr
- the ClassLoaderprimary
- the primary ClassLoader to use (or null)- Returns:
- the loaded class
-
determineIdentity
protected void determineIdentity()
Determines the identity based on MetaData defaults or user defined MetaData
-
determineSuperClassName
protected void determineSuperClassName(ClassLoaderResolver clr, Class cls)
Determine the nearest superclass that is persistable (if any).- Parameters:
clr
- The ClassLoaderResolvercls
- This class- Throws:
InvalidMetaDataException
- if the super class cannot be loaded by theclr
.InvalidMetaDataException
- if the declaredpersistence-capable-superclass
is not actually assignable fromcls
InvalidMetaDataException
- if any of the super classes is persistable, but the MetaData says that class is not persistent.
-
validateUserInputForIdentity
protected void validateUserInputForIdentity()
Check for conflicts on super class and this class MetaData identity- Throws:
InvalidMetaDataException
- if the user tries to overwrite a superclass identity / strategy
-
getBaseAbstractClassMetaData
public AbstractClassMetaData getBaseAbstractClassMetaData()
Convenience accessor for the AbstractClassMetaData of the base object in this hierarchy.- Returns:
- The AbstractClassMetaData for the base object.
-
isDescendantOf
public boolean isDescendantOf(AbstractClassMetaData cmd)
Convenience method to return if this class is a descendant of the supplied class metadata.- Parameters:
cmd
- The class to check against- Returns:
- Whether the supplied metadata is an ancestor of this
-
getBaseInheritanceStrategy
protected String getBaseInheritanceStrategy()
-
inheritIdentity
protected void inheritIdentity()
Inherit the identity definition from super classes.- Throws:
InvalidMetaDataException
- if the MetaData of this class conflicts with super classes definition
-
newDefaultedProperty
protected AbstractMemberMetaData newDefaultedProperty(String name)
Utility to add a defaulted PropertyMetaData to the class. Provided as a method since then any derived classes can override it.- Parameters:
name
- name of property- Returns:
- the new PropertyMetaData
-
validateUserInputForInheritanceMetaData
protected void validateUserInputForInheritanceMetaData(boolean isAbstract)
Check if the inheritance MetaData is credible.- Parameters:
isAbstract
- Whether this class is abstract- Throws:
InvalidMetaDataException
- if the strategy is superclass-table, yet there are no super classInvalidMetaDataException
- if the strategy is superclass-table, yet the super class has not specified a discriminatorInvalidMetaDataException
- if the strategy is superclass-table and discriminator is "value-map", yet no value for the discriminator has been specified
-
determineInheritanceMetaData
protected void determineInheritanceMetaData()
Impose a default inheritance strategy when one is not already specified. Uses the persistence property for defaultInheritanceStrategy and works to the JDO2 spec etc.
-
applyDefaultDiscriminatorValueWhenNotSpecified
protected void applyDefaultDiscriminatorValueWhenNotSpecified()
-
validateUnmappedColumns
protected void validateUnmappedColumns()
Convenience method to validate the specified "unmapped" columns.- Throws:
InvalidMetaDataException
- if a column is specified without its name.
-
getSuperAbstractClassMetaData
public final AbstractClassMetaData getSuperAbstractClassMetaData()
Accessor for the Meta-Data for the superclass of this class.- Returns:
- MetaData of the superclass
-
pkIsDatastoreAttributed
public boolean pkIsDatastoreAttributed(StoreManager storeMgr)
Convenience method to calculate and return if the pk has some component that is generated in the datastore.- Parameters:
storeMgr
- The storeManager- Returns:
- Whether the PK is datastore generated
-
determineObjectIdClass
protected void determineObjectIdClass()
Determine the object id class.- Throws:
InvalidMetaDataException
- if the class 0 or more that one primary key field and noobjectid-class
has been declared in the MetaDataInvalidMetaDataException
- if theobjectid-class
has not been set and the primary key field does not match a supported SingleFieldIdentityInvalidMetaDataException
- if the identity type is APPLICATION but not primary key fields have been setInvalidMetaDataException
- if theobjectid-class
cannot be loaded by theclr
-
validateObjectIdClass
protected void validateObjectIdClass(ClassLoaderResolver clr)
Validate the objectid-class of this class.- Parameters:
clr
- ClassLoader resolver
-
populate
public abstract void populate(ClassLoaderResolver clr, ClassLoader primary, MetaDataManager mmgr)
Method to provide the details of the class being represented by this MetaData. This can be used to firstly provide defaults for attributes that aren't specified in the MetaData, and secondly to report any errors with attributes that have been specified that are inconsistent with the class being represented. This method must be invoked by subclasses during populate operations.- Parameters:
clr
- ClassLoaderResolver to use in loading any classesprimary
- the primary ClassLoader to use (or null)mmgr
- MetaData manager
-
initialiseMemberPositionInformation
protected void initialiseMemberPositionInformation()
Method to initialise all convenience information about member positions and what role each position performs.
-
getDiscriminatorMetaDataForTable
public final DiscriminatorMetaData getDiscriminatorMetaDataForTable()
Convenience method to find the discriminator MetaData defining the discrim for the same table as this class is using. Traverses up the inheritance tree to find the highest class that uses "subclass-table" that has discriminator metadata defined, and returns the MetaData.- Returns:
- DiscriminatorMetaData for the highest class in this tree using subclass-table
-
getDiscriminatorStrategyForTable
public final DiscriminatorStrategy getDiscriminatorStrategyForTable()
Convenience accessor for the discriminator strategy applying to this class. This is specified on the class managing the table if at all.- Returns:
- The discriminator strategy
-
getDiscriminatorMetaData
public final DiscriminatorMetaData getDiscriminatorMetaData()
Convenience accessor for the discriminator metadata applying to this class. If specified on this class then returns that, otherwise goes up to the superclass (if present) until it finds a discriminator metadata specification.- Returns:
- The discriminator metadata
-
getDiscriminatorMetaDataRoot
public final DiscriminatorMetaData getDiscriminatorMetaDataRoot()
Convenience method to return the "root" discriminator metadata definition (that defines the strategy, column etc). Useful when using "complete-table" inheritance, so we apply the root definition to the table for this class.- Returns:
- Discriminator metadata for the root
-
hasDiscriminatorStrategy
public final boolean hasDiscriminatorStrategy()
Accessor for whether we have a discriminator defined for this class (may be in superclasses).- Returns:
- true if discriminatorStrategy is not null and not NONE
-
getDiscriminatorStrategy
public final DiscriminatorStrategy getDiscriminatorStrategy()
Method to return the discriminator strategy being used by this class. Returns the strategy defined on this class (if any), otherwise goes up to the superclass etc until it finds a defined strategy.- Returns:
- The discriminator strategy
-
getDiscriminatorColumnName
public String getDiscriminatorColumnName()
Return the name of the discriminator column if defined in metadata. If not provided directly for this class, goes up to the superclass to find it.- Returns:
- The column name for the discriminator
-
getDiscriminatorColumnMetaData
public ColumnMetaData getDiscriminatorColumnMetaData()
Return the metadata for the discriminator column if defined in metadata. If not provided directly for this class, goes up to the superclass to find it.- Returns:
- The column metadata for the discriminator
-
getDiscriminatorValue
public Object getDiscriminatorValue()
Method returning the discriminator value to apply to an instance of this class. If using "class-name" then returns the class name, and if using the "entity-name" returns the entity name, otherwise if using "value-map" returns the value specified directly against this class metadata. The returned value is a String unless the user defined the column as holding integer-based values, in which case a Long is returned- Returns:
- The discriminator value
-
getIdentityType
public IdentityType getIdentityType()
-
setIdentityType
public void setIdentityType(IdentityType type)
-
getName
public String getName()
Accessor for the simple class name (without package name).- Returns:
- class name
-
getFullClassName
public String getFullClassName()
Accessor for the full class name including any package name.- Returns:
- full class name.
-
getObjectidClass
public String getObjectidClass()
-
setObjectIdClass
public AbstractClassMetaData setObjectIdClass(String objectidClass)
-
getEntityName
public String getEntityName()
-
setEntityName
public AbstractClassMetaData setEntityName(String name)
-
getCatalog
public String getCatalog()
-
setCatalog
public AbstractClassMetaData setCatalog(String catalog)
-
getSchema
public String getSchema()
-
setSchema
public AbstractClassMetaData setSchema(String schema)
-
getTable
public String getTable()
-
setTable
public AbstractClassMetaData setTable(String table)
-
isRequiresExtent
public boolean isRequiresExtent()
-
setRequiresExtent
public AbstractClassMetaData setRequiresExtent(boolean flag)
-
setRequiresExtent
public AbstractClassMetaData setRequiresExtent(String flag)
-
isDetachable
public boolean isDetachable()
-
setDetachable
public AbstractClassMetaData setDetachable(boolean flag)
-
setDetachable
public AbstractClassMetaData setDetachable(String flag)
-
isCacheable
public Boolean isCacheable()
-
setCacheable
public AbstractClassMetaData setCacheable(boolean cache)
-
setCacheable
public AbstractClassMetaData setCacheable(String cache)
-
isEmbeddedOnly
public boolean isEmbeddedOnly()
-
setEmbeddedOnly
public AbstractClassMetaData setEmbeddedOnly(boolean flag)
-
setEmbeddedOnly
public AbstractClassMetaData setEmbeddedOnly(String flag)
-
getPackageMetaData
public PackageMetaData getPackageMetaData()
-
getPackageName
public String getPackageName()
-
getPersistenceModifier
public ClassPersistenceModifier getPersistenceModifier()
-
setPersistenceModifier
public AbstractClassMetaData setPersistenceModifier(ClassPersistenceModifier modifier)
-
getPersistableSuperclass
public String getPersistableSuperclass()
-
usesSingleFieldIdentityClass
public boolean usesSingleFieldIdentityClass()
Whether this persistable class uses SingleFieldIdentity- Returns:
- true if using SingleFieldIdentity as objectid class
-
isSameOrAncestorOf
public boolean isSameOrAncestorOf(AbstractClassMetaData cmd)
Check if the argument cmd is the same as this or a descedent.- Parameters:
cmd
- the AbstractClassMetaData to be verify if this is an ancestor- Returns:
- true if the argument is a child or same as this
-
getPrimaryKeyMemberNames
public String[] getPrimaryKeyMemberNames()
Accessor for the names of the primary key fields/properties. Only valid after being populated. Provided as a convenience where we need to get the names of the PK members but cant wait til initialisation.- Returns:
- names of the PK fields/properties
-
hasMember
public boolean hasMember(String memberName)
Method to check if a member exists in this classes definition. Will include any superclasses in the check.- Parameters:
memberName
- Name of member- Returns:
- return true if exists.
-
getNoOfMembers
public int getNoOfMembers()
Accessor for the number of members defined for this class (including overrides). This is the total number of members (inc static, final etc) in this class- Returns:
- no of fields/properties.
-
getMetaDataForMember
public AbstractMemberMetaData getMetaDataForMember(String name)
Accessor for the Meta-Data for a member. Include superclasses.- Parameters:
name
- the name of the member- Returns:
- Meta-Data for the member
-
getNoOfManagedMembers
public int getNoOfManagedMembers()
Accessor for the number of managed members (this class only).- Returns:
- no of managed members in this class
-
getManagedMembers
public AbstractMemberMetaData[] getManagedMembers()
Accessor for the managed fields/properties in this class (not including superclass, but including overridden).- Returns:
- MetaData for the managed fields/properties in this class
-
getOverriddenMembers
public AbstractMemberMetaData[] getOverriddenMembers()
Accessor for the overridden fields/properties in this class.- Returns:
- The overridden fields/properties in this class
-
getOverriddenMember
public AbstractMemberMetaData getOverriddenMember(String name)
Accessor for an overridden field/property with the specified name.- Parameters:
name
- Name of the field/property- Returns:
- The MetaData for the field/property
-
getMemberBeingOverridden
protected AbstractMemberMetaData getMemberBeingOverridden(String name)
Convenience method that navigates up a MetaData inheritance tree until it finds the base member definition for the specified name.- Parameters:
name
- Name of the member we require- Returns:
- The metadata for the member
-
getNoOfInheritedManagedMembers
public int getNoOfInheritedManagedMembers()
Accessor for the number of inherited managed members in superclasses.- Returns:
- No of inherited managed members in superclasses.
-
getMemberCount
public int getMemberCount()
Accessor for the number of managed members from this class plus inherited classes.- Returns:
- The number of managed members from this class plus inherited classes.
-
getMetaDataForMemberAtRelativePosition
public AbstractMemberMetaData getMetaDataForMemberAtRelativePosition(int index)
Accessor for the metadata of a member. Does not include superclasses. In general this should never be used; always use "getMetaDataForManagedMemberAtAbsolutePosition".- Parameters:
index
- field index relative to this class only starting from 0- Returns:
- Meta-Data for the member
-
getMetaDataForManagedMemberAtRelativePosition
public AbstractMemberMetaData getMetaDataForManagedMemberAtRelativePosition(int position)
Accessor for MetaData for a managed member in this class. The position is relative to the first member in this class (i.e ignores superclasses).- Parameters:
position
- The position of the managed field. 0 = first in the class- Returns:
- The managed member at that position
-
getMetaDataForManagedMemberAtAbsolutePosition
public AbstractMemberMetaData getMetaDataForManagedMemberAtAbsolutePosition(int position)
Accessor for a managed member including superclass members. Allows for overriding of superclass members in this class and superclasses.- Parameters:
position
- The position of the managed member including the superclass. Fields are numbered from 0 in the root persistable superclass.- Returns:
- The managed member at this "absolute" position.
-
getMetaDataForManagedMemberAtAbsolutePositionInternal
protected AbstractMemberMetaData getMetaDataForManagedMemberAtAbsolutePositionInternal(int abs_position)
Internal method to get the field/property for an absolute field number. If the field for that absolute field position is overridden by a field in this class then this field/property will be returned.- Parameters:
abs_position
- The position of the managed field including the superclass. Fields are numbered from 0 in the root superclass.- Returns:
- The managed field at this "absolute" position.
-
getRelativePositionOfMember
public int getRelativePositionOfMember(String memberName)
Accessor for the (relative) position of the field/property with the specified name. The returned position is relative to this class only- Parameters:
memberName
- Name of the member- Returns:
- Relative position of the member in this class
-
getAbsolutePositionOfMember
public int getAbsolutePositionOfMember(String memberName)
Accessor for the absolute position of the field/property with the specified name. The absolute position has origin in the root persistable superclass, starting at 0.- Parameters:
memberName
- Name of the member- Returns:
- Absolute position of the member
-
getNoOfPrimaryKeyMembers
public int getNoOfPrimaryKeyMembers()
Accessor for the number of primary key fields/properties.- Returns:
- no of primary key fields/properties
-
getAllMemberPositions
public int[] getAllMemberPositions()
Accessor for all field/property positions. These are absolute numbers and include superclasses and are really just 0, 1, 2, ... n.- Returns:
- The positions of all (managed) fields/properties.
-
getPKMemberPositions
public int[] getPKMemberPositions()
Accessor for the field numbers of the primary key fields/properties. These are absolute numbers (including superclasses).- Returns:
- The positions of the primary key fields/properties.
-
getNonPKMemberPositions
public int[] getNonPKMemberPositions()
Accessor for the positions of the non primary key fields/properties (inc superclass fields).- Returns:
- The member positions
-
getNonPKMemberFlags
public boolean[] getNonPKMemberFlags()
Accessor for the flags of the non primary key fields/properties (inc superclass members).- Returns:
- The flags whether the field/property is non primary key
-
getDFGMemberPositions
public int[] getDFGMemberPositions()
Accessor for the absolute positions of the default fetch group fields/properties (inc superclasses).- Returns:
- The positions of the DFG fields/properties (inc superclasses).
-
getDFGMemberFlags
public boolean[] getDFGMemberFlags()
Accessor for the flags of the DFG fields/properties (inc superclass).- Returns:
- The flags whether the field/property is in the DFG
-
getBasicMemberPositions
public int[] getBasicMemberPositions(ClassLoaderResolver clr)
Accessor for the absolute positions of fields/properties that are considered basic. This category includes members of all basic (primitive and immutable object class) types as defined in section 6.4 of the specification, including String, Date and its jdbc subtypes, Locale, Currency, and Enum types. Includes all inherited multivalued positions. WARNING : this includes transient fields. DO NOT USE as a way of getting the persistent fields in the class.- Parameters:
clr
- ClassLoader resolver- Returns:
- The absolute positions
-
getMultivaluedMemberPositions
public int[] getMultivaluedMemberPositions()
Accessor for the absolute positions of fields/properties that are considered multi-valued This category includes members of all multi-valued types, including Collection, array, and Map types of basic and relationship types. Includes all inherited multivalued positions.- Returns:
- The absolute positions
-
getSCOMutableMemberPositions
public int[] getSCOMutableMemberPositions()
Accessor for the absolute positions of the second class mutable fields/properties.- Returns:
- The field numbers of the second class mutable fields (inc superclasses).
-
getSCONonContainerMemberPositions
public int[] getSCONonContainerMemberPositions()
Accessor for the absolute positions of all SCO fields/properties that are NOT containers (e.g Dates, Points, etc)- Returns:
- Field numbers of all SCO non-container fields/properties
-
getSCOContainerMemberPositions
public int[] getSCOContainerMemberPositions()
Accessor for the absolute positions of all SCO fields/properties that are containers.- Returns:
- Positions of all SCO container fields/properties.
-
getSCOMutableMemberFlags
public boolean[] getSCOMutableMemberFlags()
Accessor for the flags of the SCO mutable fields (inc superclass fields).- Returns:
- The flags whether the field is second class mutable
-
hasRelations
public boolean hasRelations(ClassLoaderResolver clr)
Convenience method to return if the class has relations to other objects. Includes superclasses.- Parameters:
clr
- ClassLoader resolver- Returns:
- Whether the class has any relations (that it knows about)
-
getNonRelationMemberPositions
public int[] getNonRelationMemberPositions(ClassLoaderResolver clr)
-
getRelationMemberPositions
public int[] getRelationMemberPositions(ClassLoaderResolver clr)
Convenience method to return the absolute positions of all fields/properties that have relations.- Parameters:
clr
- ClassLoader resolver- Returns:
- The absolute positions of all fields/properties that have relations
-
getBidirectionalRelationMemberPositions
public int[] getBidirectionalRelationMemberPositions(ClassLoaderResolver clr)
Convenience method to return the absolute positions of fields/properties that have bidirectional relations.- Parameters:
clr
- ClassLoader resolver- Returns:
- Absolute positions of bidirectional relation fields/properties
-
setAccessViaField
public void setAccessViaField(boolean flag)
-
getAccessViaField
public Boolean getAccessViaField()
-
setMappedSuperclass
public void setMappedSuperclass(boolean mapped)
-
isMappedSuperclass
public boolean isMappedSuperclass()
-
setSerializeRead
public void setSerializeRead(boolean serialise)
-
isSerializeRead
public boolean isSerializeRead()
-
setMetaDataComplete
public void setMetaDataComplete()
Method to set that this class is "metadata complete" (see JPA spec). Means that any annotations will be ignored.
-
isMetaDataComplete
public boolean isMetaDataComplete()
Accessor for whether this class is fully specified by this metadata and that any annotations should be ignored.- Returns:
- Whether we should ignore any annotations
-
addQuery
public void addQuery(QueryMetaData qmd)
Method to add a named query to this class. Rejects the addition of duplicate named queries.- Parameters:
qmd
- Meta-Data for the query.
-
getNoOfQueries
public int getNoOfQueries()
Accessor for the number of named queries.- Returns:
- no of named queries
-
getQueries
public QueryMetaData[] getQueries()
Accessor for the metadata of the named queries.- Returns:
- Meta-Data for the named queries.
-
newQueryMetadata
public QueryMetaData newQueryMetadata(String queryName)
Method to create a new QueryMetadata, add it to the registered queries and return it.- Parameters:
queryName
- Name of the query- Returns:
- The Query metadata
-
addStoredProcQuery
public void addStoredProcQuery(StoredProcQueryMetaData qmd)
Method to add a named stored proc query to this class. Rejects the addition of duplicate named queries.- Parameters:
qmd
- Meta-Data for the query.
-
getNoOfStoredProcQueries
public int getNoOfStoredProcQueries()
Accessor for the number of named stored proc queries.- Returns:
- no of named stored proc queries
-
getStoredProcQueries
public StoredProcQueryMetaData[] getStoredProcQueries()
Accessor for the metadata of the named stored proc queries.- Returns:
- Meta-Data for the named stored proc queries.
-
newStoredProcQueryMetadata
public StoredProcQueryMetaData newStoredProcQueryMetadata(String queryName)
Method to create a new StoredProcQueryMetadata, add it to the registered queries and return it.- Parameters:
queryName
- Name of the proc query- Returns:
- The Query metadata
-
addQueryResultMetaData
public void addQueryResultMetaData(QueryResultMetaData resultMetaData)
Method to register a query-result MetaData.- Parameters:
resultMetaData
- Query-Result MetaData to register
-
getQueryResultMetaData
public QueryResultMetaData[] getQueryResultMetaData()
Get the query result MetaData registered for this class.- Returns:
- Query Result MetaData defined for this class
-
addIndex
public void addIndex(IndexMetaData idxmd)
Method to add an index to this class.- Parameters:
idxmd
- Meta-Data for the index.
-
getIndexMetaData
public final List<IndexMetaData> getIndexMetaData()
-
newIndexMetadata
public IndexMetaData newIndexMetadata()
Method to create a new index metadata, add it, and return it.- Returns:
- The index metadata
-
addForeignKey
public void addForeignKey(ForeignKeyMetaData fkmd)
Method to add an foreign-key to this class.- Parameters:
fkmd
- Meta-Data for the foreign-key.
-
getForeignKeyMetaData
public final List<ForeignKeyMetaData> getForeignKeyMetaData()
-
newForeignKeyMetadata
public ForeignKeyMetaData newForeignKeyMetadata()
Method to create a new FK metadata, add it, and return it.- Returns:
- The FK metadata
-
addUniqueConstraint
public void addUniqueConstraint(UniqueMetaData unimd)
Method to add a unique constraint to this class.- Parameters:
unimd
- Meta-Data for the unique constraint.
-
getUniqueMetaData
public final List<UniqueMetaData> getUniqueMetaData()
-
newUniqueMetadata
public UniqueMetaData newUniqueMetadata()
Method to create a new unique metadata, add it, and return it.- Returns:
- The unique metadata
-
addUnmappedColumn
public final void addUnmappedColumn(ColumnMetaData colmd)
Method to add an unmapped column.- Parameters:
colmd
- The metadata for the unmapped column
-
getUnmappedColumns
public final List<ColumnMetaData> getUnmappedColumns()
Accessor for the unmapped columns required for the datastore table.- Returns:
- The list of unmapped columns
-
newUnmappedColumnMetaData
public ColumnMetaData newUnmappedColumnMetaData()
-
newFieldMetadata
public FieldMetaData newFieldMetadata(String fieldName)
Method to create a new field metadata, add it, and return it.- Parameters:
fieldName
- Name of the field- Returns:
- The metadata
-
newPropertyMetadata
public PropertyMetaData newPropertyMetadata(String propName)
Method to create a new property metadata, add it, and return it.- Parameters:
propName
- Name of the property- Returns:
- The metadata
-
addMember
public void addMember(AbstractMemberMetaData mmd)
Method to add a field/property to this interface. Rejects the addition of duplicate named fields/properties.- Parameters:
mmd
- Field/Property MetaData
-
addFetchGroup
public void addFetchGroup(FetchGroupMetaData fgmd)
Method to add a fetch-group to this class.- Parameters:
fgmd
- Meta-Data for the fetch-group.
-
newFetchGroupMetaData
public FetchGroupMetaData newFetchGroupMetaData(String name)
Method to create a new fetchgroup metadata, add it, and return it.- Parameters:
name
- Name of the group- Returns:
- The fetchgroup metadata
-
getFetchGroupMetaData
public Set<FetchGroupMetaData> getFetchGroupMetaData(Collection<String> groupNames)
Accessor for fetch group metadata for the specified groups (if present). The returned metadata is what is defined for this class that matches any of the names in the input set.- Parameters:
groupNames
- Names of the fetch groups- Returns:
- MetaData for the groups
-
getFetchGroupMetaData
public FetchGroupMetaData getFetchGroupMetaData(String groupname)
Accessor for the fetch group metadata for the group specified.- Parameters:
groupname
- Name of the fetch group- Returns:
- MetaData for this group
-
getFetchGroupMetaData
public final Set<FetchGroupMetaData> getFetchGroupMetaData()
Accessor for all MetaData defined for fetch groups for this class. This doesn't include superclasses.- Returns:
- Returns the Fetch Group metadata registered on this class
-
hasFetchGroupWithPostLoad
public final boolean hasFetchGroupWithPostLoad()
Whether this class or any super class has any fetch group definition withFetchGroupMetaData.getPostLoad()
==true.- Returns:
- Whether there is a fetch-group definition with post-load
-
addJoin
public void addJoin(JoinMetaData jnmd)
Method to add a join to this class. Rejects the addition of duplicate named fields.- Parameters:
jnmd
- Meta-Data for the join.
-
getJoinMetaData
public final List<JoinMetaData> getJoinMetaData()
-
newJoinMetaData
public JoinMetaData newJoinMetaData()
Method to create a new join metadata, add it, and return it.- Returns:
- The join metadata
-
addListener
public void addListener(EventListenerMetaData listener)
Add a listener class name- Parameters:
listener
- the listener metadata. Duplicated classes are ignored
-
getListenerForClass
public EventListenerMetaData getListenerForClass(String className)
Accessor for the EventListener info for an EventListener class name- Parameters:
className
- Name of the event listener class- Returns:
- EventListener info for this class (or null if the class isnt an EventListener)
-
getListeners
public List<EventListenerMetaData> getListeners()
Get the event listeners- Returns:
- the event listeners
-
excludeSuperClassListeners
public void excludeSuperClassListeners()
Toogle exclude super class listeners
-
isExcludeSuperClassListeners
public boolean isExcludeSuperClassListeners()
Whether super classes listeners are not going to be invoked- Returns:
- true if super class listeners are not invoked
-
excludeDefaultListeners
public void excludeDefaultListeners()
Method to exclude default listeners.
-
isExcludeDefaultListeners
public boolean isExcludeDefaultListeners()
Whether default listeners are not going to be invoked- Returns:
- true if default listeners are not invoked
-
setVersionMetaData
public final void setVersionMetaData(VersionMetaData versionMetaData)
Mutator for the Version MetaData.- Parameters:
versionMetaData
- The versionMetaData to set.
-
getVersionMetaData
public final VersionMetaData getVersionMetaData()
Accessor for Version MetaData for this class specifically. Note that this just returns what this class had defined, and if this has no version info then you really need what the superclass has (if there is one). Consider using getVersionMetaDataForClass().- Returns:
- Returns the versionMetaData.
-
getVersionMetaDataForClass
public final VersionMetaData getVersionMetaDataForClass()
Convenience accessor for the version metadata applying to this class. Differs from getVersionMetaData by searching superclasses.- Returns:
- The version metadata
-
isVersioned
public final boolean isVersioned()
Returns whether objects of this type are versioned. A return of true means that either this class has version information, or a superclass does, and that the version information is required to be stored.- Returns:
- Whether it is versioned.
-
getVersionMetaDataForTable
public final VersionMetaData getVersionMetaDataForTable()
Convenience method to find the version MetaData defining versioning for the same 'table' as this class is using. Traverses up the inheritance tree to find the highest class that uses "subclass-table" that has version metadata defined, or the class that owns the 'table' where this class uses "superclass-table", and returns the MetaData.- Returns:
- Version MetaData for the highest class in this tree using subclass-table
-
newVersionMetadata
public VersionMetaData newVersionMetadata()
Method to create a new version metadata, set to use it, and return it.- Returns:
- The version metadata
-
setIdentityMetaData
public final void setIdentityMetaData(IdentityMetaData identityMetaData)
Mutator for the identity MetaData.- Parameters:
identityMetaData
- The identityMetaData to set.
-
getIdentityMetaData
public final IdentityMetaData getIdentityMetaData()
Accessor for identityMetaData- Returns:
- Returns the identityMetaData.
-
getBaseIdentityMetaData
public final IdentityMetaData getBaseIdentityMetaData()
Convenience method to return the root identity metadata for this inheritance tree.- Returns:
- IdentityMetaData at the base
-
newIdentityMetadata
public IdentityMetaData newIdentityMetadata()
Method to create a new identity metadata, set to use it, and return it.- Returns:
- The identity metadata
-
setInheritanceMetaData
public final void setInheritanceMetaData(InheritanceMetaData inheritanceMetaData)
Mutator for the inheritance MetaData.- Parameters:
inheritanceMetaData
- The inheritanceMetaData to set.
-
getInheritanceMetaData
public final InheritanceMetaData getInheritanceMetaData()
Accessor for inheritanceMetaData- Returns:
- Returns the inheritanceMetaData.
-
newInheritanceMetadata
public InheritanceMetaData newInheritanceMetadata()
Method to create a new inheritance metadata, set to use it, and return it.- Returns:
- The inheritance metadata
-
setPrimaryKeyMetaData
public final void setPrimaryKeyMetaData(PrimaryKeyMetaData primaryKeyMetaData)
Mutator for the PrimaryKey MetaData.- Parameters:
primaryKeyMetaData
- The PrimaryKey MetaData to set.
-
getPrimaryKeyMetaData
public final PrimaryKeyMetaData getPrimaryKeyMetaData()
Accessor for primaryKeyMetaData- Returns:
- Returns the primaryKey MetaData.
-
newPrimaryKeyMetadata
public PrimaryKeyMetaData newPrimaryKeyMetadata()
Method to create a new primary key metadata, set to use it, and return it.- Returns:
- The primary key metadata
-
checkForCircularViewReferences
protected static void checkForCircularViewReferences(Map<String,Set<String>> viewReferences, String referencerName, String referenceeName, List<String> referenceChain)
Check for any circular view references between referencer and referencee. If one is found, throw a NucleusUserException with the chain of references.- Parameters:
viewReferences
- The Map of view references to check.referencerName
- Name of the class that has the reference.referenceeName
- Name of the class that is being referenced.referenceChain
- The List of class names that have been referenced- Throws:
NucleusUserException
- If a circular reference is found in the view definitions.
-
-