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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • 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:
    • 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/Jakarta $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/Jakarta 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/Jakarta).
    • 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
    • datastoreIdentityMetaData

      protected DatastoreIdentityMetaData datastoreIdentityMetaData
    • multitenancyMetaData

      protected MultitenancyMetaData multitenancyMetaData
    • softDeleteMetaData

      protected SoftDeleteMetaData softDeleteMetaData
    • identitySpecified

      protected boolean identitySpecified
      Flag whether the identity was specified by the user.
    • inheritanceMetaData

      protected InheritanceMetaData inheritanceMetaData
    • primaryKeyMetaData

      protected PrimaryKeyMetaData primaryKeyMetaData
    • 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
    • indexes

      protected List<IndexMetaData> indexes
    • uniqueConstraints

      protected List<UniqueMetaData> uniqueConstraints
    • joins

      protected List<JoinMetaData> 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.
    • valueGenerationMemberPositions

      protected int[] valueGenerationMemberPositions
      Positions of fields/properties that require value-generation to be assigned (non-null strategy).
    • createTimestampMemberPosition

      protected int createTimestampMemberPosition
    • updateTimestampMemberPosition

      protected int updateTimestampMemberPosition
    • createUserMemberPosition

      protected int createUserMemberPosition
    • updateUserMemberPosition

      protected int updateUserMemberPosition
    • 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.
    • scoContainerMemberFlags

      protected boolean[] scoContainerMemberFlags
    • 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
    • populating

      boolean populating
      whether the populate method is running
    • initialising

      boolean initialising
      whether the initialise method is running
    • fetchGroupMetaWithPostLoad

      protected Boolean fetchGroupMetaWithPostLoad
    • pkIsDatastoreAttributed

      protected Boolean pkIsDatastoreAttributed
    • hasRelations

      protected Boolean hasRelations
    • 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.
  • Constructor Details

    • AbstractClassMetaData

      protected AbstractClassMetaData(PackageMetaData parent, String name)
      Constructor. Set fields using setters, before populate().
      Parameters:
      parent - The package to which this class/interface belongs
      name - (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 class
      copyMembers - 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 Details

    • getMetaDataManager

      public MetaDataManager getMetaDataManager()
      Overrides:
      getMetaDataManager in class MetaData
    • 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 ClassLoader
      primary - 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 ClassLoaderResolver
      cls - This class
      Throws:
      InvalidMetaDataException - if the super class cannot be loaded by the clr.
      InvalidMetaDataException - if the declared persistence-capable-superclass is not actually assignable from cls
      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 class
      InvalidMetaDataException - if the strategy is superclass-table, yet the super class has not specified a discriminator
      InvalidMetaDataException - 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.
    • getSuperclassManagingTable

      private AbstractClassMetaData getSuperclassManagingTable()
      Utility to find the immediate superclass that manages its own table. Checks up the inheritance tree for one that uses "new-table" inheritance strategy.
      Returns:
      Metadata for the superclass that uses "NEW-TABLE" (or null, if none found).
    • getClassManagingTable

      private AbstractClassMetaData getClassManagingTable()
      Utility to navigate up to superclasses to find the next class with its own table.
      Returns:
      The AbstractClassMetaData of the class managing its own table
    • 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 no objectid-class has been declared in the MetaData
      InvalidMetaDataException - if the objectid-class has not been set and the primary key field does not match a supported SingleFieldIdentity
      InvalidMetaDataException - if the identity type is APPLICATION but not primary key fields have been set
      InvalidMetaDataException - if the objectid-class cannot be loaded by the clr
    • 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 classes
      primary - 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
    • getNoOfPopulatedPKMembers

      private int getNoOfPopulatedPKMembers()
      Convenience method to check the number of fields/properties in this class that have been populated and that are primary key members. This is only ever called during populate() since the accessor for PK members cant be used yet due to lack of initialisation. Recurses to its superclass if it has a superclass.
      Returns:
      The number of PK members
    • 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
    • getValueGenerationMemberPositions

      public int[] getValueGenerationMemberPositions()
      Accessor for the member positions which require value generation processing (non-null strategy).
      Returns:
      The member positions that will have a value generated.
    • getCreateTimestampMemberPosition

      public int getCreateTimestampMemberPosition()
    • getUpdateTimestampMemberPosition

      public int getUpdateTimestampMemberPosition()
    • getCreateUserMemberPosition

      public int getCreateUserMemberPosition()
    • getUpdateUserMemberPosition

      public int getUpdateUserMemberPosition()
    • 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
    • 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
    • getSCOContainerMemberFlags

      public boolean[] getSCOContainerMemberFlags()
      Accessor for the flags of whether members are SCO "containers" (Collection/Map/array).
      Returns:
      The array of SCO container flags
    • 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 with FetchGroupMetaData.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
    • setDatastoreIdentityMetaData

      public final void setDatastoreIdentityMetaData(DatastoreIdentityMetaData identityMetaData)
      Mutator for the datastore identity MetaData.
      Parameters:
      identityMetaData - The datastore identity MetaData to set.
    • getDatastoreIdentityMetaData

      public final DatastoreIdentityMetaData getDatastoreIdentityMetaData()
      Accessor for datastore identity MetaData
      Returns:
      Returns the datastore identity MetaData.
    • getBaseDatastoreIdentityMetaData

      public final DatastoreIdentityMetaData getBaseDatastoreIdentityMetaData()
      Convenience method to return the root identity metadata for this inheritance tree.
      Returns:
      DatastoreIdentityMetaData at the base
    • newDatastoreIdentityMetaData

      public DatastoreIdentityMetaData newDatastoreIdentityMetaData()
      Method to create a new datastore identity metadata, set to use it, and return it.
      Returns:
      The datastore identity metadata
    • getMultitenancyMetaData

      public final MultitenancyMetaData getMultitenancyMetaData()
    • setMultitenancyMetaData

      public final void setMultitenancyMetaData(MultitenancyMetaData mtmd)
    • newMultitenancyMetaData

      public MultitenancyMetaData newMultitenancyMetaData()
    • getSoftDeleteMetaData

      public final SoftDeleteMetaData getSoftDeleteMetaData()
    • setSoftDeleteMetaData

      public final void setSoftDeleteMetaData(SoftDeleteMetaData sdmd)
    • newSoftDeleteMetaData

      public SoftDeleteMetaData newSoftDeleteMetaData()
    • isSoftDelete

      public boolean isSoftDelete()
    • 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
    • getReferencedClassMetaData

      void getReferencedClassMetaData(List<AbstractClassMetaData> orderedCmds, Set<AbstractClassMetaData> referencedCmds, ClassLoaderResolver clr)
      Method to return the ClassMetaData records for classes referenced by this object. This adds the entries to orderedCmds ordered by dependency, and to referencedCmds for fast lookups.

      Uses recursion to add all referenced ClassMetaData for any fields, objectid classes, superclasses, and extension "views". This is the entry point for this process.

      Parameters:
      orderedCmds - List of ordered ClassMetaData objects (added to).
      referencedCmds - Set of all ClassMetaData objects (added to).
      clr - the ClassLoaderResolver
    • getReferencedClassMetaData

      private void getReferencedClassMetaData(List<AbstractClassMetaData> orderedCmds, Set<AbstractClassMetaData> referencedCmds, Map<String,Set<String>> viewReferences, ClassLoaderResolver clr)
      Method to return the ClassMetaData for classes referenced by this object. This method does the actual work of addition.
      Parameters:
      orderedCmds - List of ordered ClassMetaData objects (added to).
      referencedCmds - Set of all ClassMetaData objects (added to).
      viewReferences - Map, mapping class name to set of referenced class for all views.
      clr - the ClassLoaderResolver
    • addViewReference

      private void addViewReference(Map<String,Set<String>> viewReferences, String referencedName)
      Method to add a reference for views. Check the view references for circular dependencies. If there are any circular dependencies, throw a NucleusUserException.
      Parameters:
      viewReferences - The Map of classname to Set of referenced Classes to add the reference to.
      referencedName - Class name of the referenced class
      Throws:
      NucleusUserException - Thrown if a circular reference is found
    • 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.