Package org.datanucleus.metadata
Class AbstractMemberMetaData
- java.lang.Object
-
- org.datanucleus.metadata.MetaData
-
- org.datanucleus.metadata.AbstractMemberMetaData
-
- All Implemented Interfaces:
Serializable
,Comparable
,ColumnMetaDataContainer
- Direct Known Subclasses:
FieldMetaData
,PropertyMetaData
public abstract class AbstractMemberMetaData extends MetaData implements Comparable, ColumnMetaDataContainer
Abstract representation of MetaData for a field/property of a class/interface. The term "member" is used to represent either a field or a method(property). The term property is used to represent the name after cutting off any Java-beans style "get" prefix. This class is extended for fields (FieldMetaData) and properties (PropertyMetaData) to provide the explicit support for those components.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
cacheable
cacheable tag value.protected Boolean
cascadeAttach
Whether to attach this relation when attaching the owning object.protected Boolean
cascadeDelete
Whether to delete this relation when deleting the owning object (JPA/Jakarta).protected Boolean
cascadeDetach
Whether to detach this relation when detaching the owning object (JPA/Jakarta).protected Boolean
cascadePersist
Whether to persist this relation when persisting the owning object.protected Boolean
cascadeRefresh
Whether to refresh this relation when refreshing the owning object (JPA/Jakarta).protected boolean
cascadeRemoveOrphans
Whether to remove orphans when deleting the owning object (JPA/Jakarta).protected String
catalog
Catalog for the table specified for this field.protected String
className
Name of the class to which this field really belongs.protected String
column
column tag value.protected ColumnMetaData[]
columnMetaData
Contains the metadata for column(s).protected List<ColumnMetaData>
columns
Columns ColumnMetaDataprotected ContainerMetaData
containerMetaData
Meta-Data of any container.protected Boolean
defaultFetchGroup
default-fetch-group tag value.protected Boolean
dependent
Whether this field contains a reference that should be deleted when deleting this field.protected ElementMetaData
elementMetaData
ElementMetaData.protected Boolean
embedded
embedded tag value.protected EmbeddedMetaData
embeddedMetaData
Definition of embedding.static String
EXTENSION_MEMBER_FETCH_FK_ONLY
Member : whether to fetch just the FK (and not populate the related object).protected int
fieldId
Id of the field in its class (only for fields that are managed).protected ForeignKeyMetaData
foreignKeyMetaData
ForeignKeyMetaData.protected String
fullFieldName
Cache result ofgetFullFieldName()
.protected IndexedValue
indexed
The indexing valueprotected IndexMetaData
indexMetaData
IndexMetaData.protected JoinMetaData
joinMetaData
JoinMetaData.protected KeyMetaData
keyMetaData
KeyMetaData.protected String
loadFetchGroup
load-fetch-group value.protected String
mappedBy
mapped-by tag value.protected String
mapsIdAttribute
Placeholder for the JPA "mapsId" attribute, in case a store plugin wants to use itprotected Member
memberRepresented
The member (field/method) being represented here.protected String
name
Field name.protected NullValue
nullValue
null-value tag value (default is NONE).protected boolean
ordered
Temporary flag to signify if the field is ordered.protected OrderMetaData
orderMetaData
OrderMetaData.static boolean
PERSIST_FINAL
Whether we currently allow persistence of final fields.static boolean
PERSIST_STATIC
Whether we currently allow persistence of static fields.static boolean
PERSIST_TRANSIENT
Whether we currently allow persistence of transient fields.protected byte
persistenceFlags
Flags for use in enhancement process [see JDO spec 21.14]protected FieldPersistenceModifier
persistenceModifier
persistence-modifier tag value.protected Boolean
primaryKey
primary key tag value.protected Integer
recursionDepth
recursion-depth value.protected AbstractMemberMetaData[]
relatedMemberMetaData
MetaData for the other end of a relation when this member is a bidirectional relation.protected RelationType
relationType
The relation type of this field (1-1, 1-N, M-N, N-1).protected String
relationTypeString
Placeholder for the JPA relation type ManyToOne, OneToOne etc so we can store what the user specified.protected String
schema
Schema for the table specified for this field.protected String
sequence
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.protected Boolean
serialized
serialized tag value.protected boolean
storeInLob
Wrapper for the ugly JPA "lob" so that when being populated we should make this serialised in some way.protected String
table
Table name for this field.protected String
targetClassName
Name of the target entity (when used with JPA MetaData on OneToOne, OneToMany etc)protected Class
type
Field type being represented.protected boolean
uniqueConstraint
Whether to add a unique constraint.protected UniqueMetaData
uniqueMetaData
UniqueMetaData.protected String
valueGeneratorName
Name of a value generator if the user wants to override the default generator.protected ValueMetaData
valueMetaData
ValueMetaData.protected ValueGenerationStrategy
valueStrategy
The value-strategy attribute specifies the strategy used to generate values for the field.-
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_JDBC_TYPE, EXTENSION_CLASS_MULTITENANT, 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_INDEX_COLUMN_ORDERING, EXTENSION_MEMBER_CACHEABLE, EXTENSION_MEMBER_CALENDAR_ONE_COLUMN, EXTENSION_MEMBER_CASCADE_ATTACH, EXTENSION_MEMBER_CASCADE_DETACH, EXTENSION_MEMBER_CASCADE_PERSIST, EXTENSION_MEMBER_CASCADE_REFRESH, EXTENSION_MEMBER_COMPARATOR_NAME, EXTENSION_MEMBER_CONTAINER_ALLOW_NULLS, EXTENSION_MEMBER_CREATE_TIMESTAMP, EXTENSION_MEMBER_CREATE_USER, EXTENSION_MEMBER_ENUM_VALUE_GETTER, 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_UPDATE_TIMESTAMP, EXTENSION_MEMBER_UPDATE_USER, EXTENSION_MEMBER_UPDATEABLE, EXTENSION_MEMBER_VALUE_IMPLEMENTATION_CLASSES, EXTENSION_VERSION_NUMBER_INITIAL_VALUE, extensions, metaDataState, parent, VENDOR_NAME
-
-
Constructor Summary
Constructors Constructor Description AbstractMemberMetaData(MetaData parent, String name)
Constructor for a fields metadata.AbstractMemberMetaData(MetaData parent, AbstractMemberMetaData mmd)
Convenience constructor to copy the specification from the passed member.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumn(ColumnMetaData colmd)
Add a new ColumnMetaData elementMetaData
addExtension(String key, String value)
MetaData
addExtensions(Map<String,String> exts)
boolean
calcIsSecondClassMutable(MetaDataManager mmgr)
Calculate whether this field should be a second class mutable field.void
clearColumns()
int
compareTo(Object o)
Comparator method.boolean
fieldBelongsToClass()
Accessor for whether the field is for a superclass, and not for this class.int
getAbsoluteFieldNumber()
Accessor for the absolute field idAbstractClassMetaData
getAbstractClassMetaData()
Convenience accessor for the MetaData of the parent class.ArrayMetaData
getArray()
Accessor for an array container for this field.String
getCatalog()
String
getClassName()
Accessor for the fully-qualified class name owning this field.String
getClassName(boolean fully_qualified)
Convenience to return the class name that this a field of.CollectionMetaData
getCollection()
Accessor for a collection container for this field.ColumnMetaData[]
getColumnMetaData()
Acessor for the columnsContainerMetaData
getContainer()
Accessor for the container for this field.FieldPersistenceModifier
getDefaultFieldPersistenceModifier(Class c, int modifier, boolean isPCclass, MetaDataManager mmgr)
Accessor for the default "persistence-modifier" for a field given the class, its modifier and whether it is a Persistable class.ElementMetaData
getElementMetaData()
Accessor for elementMetaDataEmbeddedMetaData
getEmbeddedMetaData()
Accessor for embeddedMetaDataint
getFieldId()
Accessor for the field id.String[]
getFieldTypes()
Accessor for the implementation type(s) that can be stored in this field when it is a reference type.ForeignKeyMetaData
getForeignKeyMetaData()
Accessor for foreignKeyMetaDataString
getFullFieldName()
Accessor for the full field name.IndexedValue
getIndexed()
IndexMetaData
getIndexMetaData()
Accessor for indexMetaDataJoinMetaData
getJoinMetaData()
Accessor for joinMetaDataKeyMetaData
getKeyMetaData()
Accessor for keyMetaDataString
getLoadFetchGroup()
MapMetaData
getMap()
Accessor for a map container for this field.String
getMappedBy()
String
getMapsIdAttribute()
Member
getMemberRepresented()
Accessor for the member being represented.String
getName()
Accessor for the field nameNullValue
getNullValue()
OrderMetaData
getOrderMetaData()
Accessor for orderMetaDataprotected static MetaData
getOverallParentClassMetaData(MetaData metadata)
Convenience method to navigate back through the parents to find the overall ClassMetaData handling this object.String
getPackageName()
byte
getPersistenceFlags()
Accessor for the persistence flagsFieldPersistenceModifier
getPersistenceModifier()
Integer
getRecursionDepth()
AbstractMemberMetaData[]
getRelatedMemberMetaData(ClassLoaderResolver clr)
Accessor for the FieldMetaData of any related field/property (where this field is part of a bidirectional relation).AbstractMemberMetaData
getRelatedMemberMetaDataForObject(ClassLoaderResolver clr, Object thisPC, Object otherPC)
Convenience accessor for the MetaData for the field/property at the other side of the bidirectional relation given the objects at this side and the other side.RelationType
getRelationType(ClassLoaderResolver clr)
Accessor for the relation type for this field.String
getRelationTypeString()
String
getSchema()
String
getSequence()
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.String
getTable()
String
getTargetClassName()
Class
getType()
Accessor for the field typeString
getTypeConverterName()
String
getTypeName()
Accessor for the field type nameUniqueMetaData
getUniqueMetaData()
Accessor for uniqueMetaDataString
getValueGeneratorName()
Name of a (user-provided) value generator to override the default generator for this strategy.ValueMetaData
getValueMetaData()
Accessor for valueMetaDataValueGenerationStrategy
getValueStrategy()
boolean
hasArray()
Accessor for whether the field has an arrayboolean
hasCollection()
Accessor for whether the field has a collectionboolean
hasContainer()
Accessor for whether the field has a container.boolean
hasMap()
Accessor for whether the field has a map.void
initialise(ClassLoaderResolver clr)
Initialisation method.boolean
isAbstract()
Convenience method to return if this field represents an abstract property.boolean
isCacheable()
boolean
isCascadeAttach()
Accessor for the whether this field should be cascaded at attach.boolean
isCascadeDelete()
Accessor for the whether this field should be cascaded at delete.boolean
isCascadeDetach()
Accessor for the whether this field should be cascaded at detach.boolean
isCascadePersist()
Accessor for the whether this field should be cascaded at persist.boolean
isCascadeRefresh()
Accessor for the whether this field should be cascaded at refresh.boolean
isCascadeRemoveOrphans()
Accessor for the whether this field should remove orphans at delete.boolean
isCreateTimestamp()
boolean
isCreateUser()
boolean
isDefaultFetchGroup()
boolean
isDependent()
boolean
isEmbedded()
boolean
isFieldArrayTypePersistable(MetaDataManager mmgr)
Utility to return if this array field has elements that are Persistable.boolean
isFieldToBePersisted()
Accessor for whether the field is to be persisted by the persistence process.boolean
isFinal()
Convenience method to return if this field/property is final.boolean
isInsertable()
Convenience method to return if the field/property is insertable.boolean
isOrdered()
boolean
isPersistentInterface(ClassLoaderResolver clr)
Convenience method to return if this member relates to a persistent interface.boolean
isPrimaryKey()
boolean
isPrivate()
Convenience method to return if this field/property is private.boolean
isProtected()
Convenience method to return if this field/property is protected.boolean
isPublic()
Convenience method to return if this field/property is public.boolean
isRelationOwner(ClassLoaderResolver clr)
Convenience method for whether this field is the owner of the relation.boolean
isSerialized()
boolean
isSingleCollection()
Accessor for whether the field has a collection that holds only one element.boolean
isStatic()
Convenience method to return if this field/property is static.boolean
isTransient()
Convenience method to return if this field/property is transient.boolean
isTypeConversionDisabled()
boolean
isUnique()
boolean
isUpdateable()
Convenience method to return if the field/property is updateable.boolean
isUpdateTimestamp()
boolean
isUpdateUser()
ArrayMetaData
newArrayMetaData()
Method to create a new array metadata, set it, and return it.CollectionMetaData
newCollectionMetaData()
Method to create a new collection metadata, set it, and return it.ColumnMetaData
newColumnMetaData()
ElementMetaData
newElementMetaData()
Method to create a new element metadata, set it, and return it.EmbeddedMetaData
newEmbeddedMetaData()
Method to create a new embedded metadata, set it, and return it.ForeignKeyMetaData
newForeignKeyMetaData()
Method to create a new FK metadata, set it, and return it.IndexMetaData
newIndexMetaData()
Method to create a new index metadata, set it, and return it.JoinMetaData
newJoinMetaData()
Method to create a new join metadata, set it, and return it.KeyMetaData
newKeyMetaData()
Method to create a new key metadata, set it, and return it.MapMetaData
newMapMetaData()
Method to create a new map metadata, set it, and return it.OrderMetaData
newOrderMetaData()
Method to create a new order metadata, set it, and return it.UniqueMetaData
newUniqueMetaData()
Method to create a new unique metadata, set it, and return it.ValueMetaData
newValueMetaData()
Method to create a new value metadata, set it, and return it.void
populate(ClassLoaderResolver clr, Field field, Method method, ClassLoader primary, MetaDataManager mmgr)
Method to provide the details of the field being represented by this MetaData hence populating certain parts of the MetaData.void
setCacheable(boolean cache)
void
setCascadeAttach(boolean cascade)
Mutator for the cascading of attach operations on this field.void
setCascadeDelete(boolean cascade)
Mutator for the cascading of delete operations on this field.void
setCascadeDetach(boolean cascade)
Mutator for the cascading of detach operations on this field.void
setCascadePersist(boolean cascade)
Mutator for the cascading of persist operations on this field.void
setCascadeRefresh(boolean cascade)
Mutator for the cascading of refresh operations on this field.void
setCascadeRemoveOrphans(boolean cascade)
Mutator for the cascading of orphan removal operations on this field.AbstractMemberMetaData
setCatalog(String catalog)
AbstractMemberMetaData
setColumn(String col)
void
setContainer(ContainerMetaData conmd)
Method to set the container for this field (if this field represents a container (collection, map, array).void
setDefaultFetchGroup(boolean dfg)
void
setDeleteAction(String action)
void
setDependent(boolean dependent)
void
setElementMetaData(ElementMetaData elementMetaData)
Mutator for the element MetaDatavoid
setEmbedded(boolean val)
void
setEmbeddedMetaData(EmbeddedMetaData embeddedMetaData)
Mutator for the embedded MetaDataMetaData
setExtensions(Map<String,String> exts)
void
setFieldTypes(String types)
Mutator for the possible field type(s) that this reference field can store.void
setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
Mutator for the foreignKey MetaDataAbstractMemberMetaData
setIndexed(IndexedValue val)
void
setIndexMetaData(IndexMetaData indexMetaData)
Mutator for the index MetaDatavoid
setJoinMetaData(JoinMetaData joinMetaData)
Mutator for the join MetaDatavoid
setKeyMetaData(KeyMetaData keyMetaData)
Mutator for the key MetaDatavoid
setLoadFetchGroup(String loadFetchGroup)
void
setMappedBy(String mappedBy)
void
setMapsIdAttribute(String attr)
void
setNotPersistent()
AbstractMemberMetaData
setNullValue(NullValue val)
void
setOrdered()
Mutator for whether the collection stored in this field is ordered.void
setOrderMetaData(OrderMetaData orderMetaData)
Mutator for the order MetaDatavoid
setPersistenceModifier(FieldPersistenceModifier modifier)
AbstractMemberMetaData
setPrimaryKey(boolean flag)
void
setRecursionDepth(int depth)
void
setRecursionDepth(String depth)
protected void
setRelation(ClassLoaderResolver clr)
Convenience method that sets up the relation type of this field, and the reference to any related field when it is bidirectional.void
setRelationTypeString(String relType)
AbstractMemberMetaData
setSchema(String schema)
void
setSequence(String sequence)
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.void
setSerialised(boolean flag)
void
setStoreInLob()
Mutator for whetehr to store as a "lob".AbstractMemberMetaData
setTable(String table)
void
setTargetClassName(String target)
Mutator for the target class name.void
setTransactional()
void
setTypeConverterDisabled()
void
setTypeConverterName(String name)
AbstractMemberMetaData
setUnique(boolean unique)
AbstractMemberMetaData
setUnique(String unique)
void
setUniqueMetaData(UniqueMetaData uniqueMetaData)
Mutator for the unique MetaDatavoid
setValueGeneratorName(String generator)
Mutator for the name of the value generator to use for this strategy.void
setValueMetaData(ValueMetaData valueMetaData)
Mutator for the value MetaDatavoid
setValueStrategy(String strategy)
void
setValueStrategy(ValueGenerationStrategy valueStrategy)
-
Methods inherited from class org.datanucleus.metadata.MetaData
getExtensions, getMetaDataManager, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, isInitialised, isPopulated, isUsed, removeExtension, setParent
-
-
-
-
Field Detail
-
PERSIST_STATIC
public static final boolean PERSIST_STATIC
Whether we currently allow persistence of static fields.- See Also:
- Constant Field Values
-
PERSIST_FINAL
public static final boolean PERSIST_FINAL
Whether we currently allow persistence of final fields.- See Also:
- Constant Field Values
-
PERSIST_TRANSIENT
public static final boolean PERSIST_TRANSIENT
Whether we currently allow persistence of transient fields.- See Also:
- Constant Field Values
-
columnMetaData
protected ColumnMetaData[] columnMetaData
Contains the metadata for column(s).
-
containerMetaData
protected ContainerMetaData containerMetaData
Meta-Data of any container.
-
embeddedMetaData
protected EmbeddedMetaData embeddedMetaData
Definition of embedding. Only present if defined by user.
-
joinMetaData
protected JoinMetaData joinMetaData
JoinMetaData.
-
elementMetaData
protected ElementMetaData elementMetaData
ElementMetaData.
-
keyMetaData
protected KeyMetaData keyMetaData
KeyMetaData.
-
valueMetaData
protected ValueMetaData valueMetaData
ValueMetaData.
-
indexMetaData
protected IndexMetaData indexMetaData
IndexMetaData.
-
indexed
protected IndexedValue indexed
The indexing value
-
uniqueMetaData
protected UniqueMetaData uniqueMetaData
UniqueMetaData.
-
uniqueConstraint
protected boolean uniqueConstraint
Whether to add a unique constraint.
-
orderMetaData
protected OrderMetaData orderMetaData
OrderMetaData.
-
foreignKeyMetaData
protected ForeignKeyMetaData foreignKeyMetaData
ForeignKeyMetaData.
-
defaultFetchGroup
protected Boolean defaultFetchGroup
default-fetch-group tag value.
-
column
protected String column
column tag value.
-
mappedBy
protected String mappedBy
mapped-by tag value.
-
embedded
protected Boolean embedded
embedded tag value.
-
serialized
protected Boolean serialized
serialized tag value.
-
cacheable
protected boolean cacheable
cacheable tag value.
-
dependent
protected Boolean dependent
Whether this field contains a reference that should be deleted when deleting this field.
-
cascadePersist
protected Boolean cascadePersist
Whether to persist this relation when persisting the owning object.
-
cascadeDelete
protected Boolean cascadeDelete
Whether to delete this relation when deleting the owning object (JPA/Jakarta). This is only used at metadata population. See "dependent".
-
cascadeAttach
protected Boolean cascadeAttach
Whether to attach this relation when attaching the owning object.
-
cascadeDetach
protected Boolean cascadeDetach
Whether to detach this relation when detaching the owning object (JPA/Jakarta).
-
cascadeRefresh
protected Boolean cascadeRefresh
Whether to refresh this relation when refreshing the owning object (JPA/Jakarta).
-
cascadeRemoveOrphans
protected boolean cascadeRemoveOrphans
Whether to remove orphans when deleting the owning object (JPA/Jakarta).
-
loadFetchGroup
protected String loadFetchGroup
load-fetch-group value.
-
recursionDepth
protected Integer recursionDepth
recursion-depth value.
-
name
protected final String name
Field name.
-
nullValue
protected NullValue nullValue
null-value tag value (default is NONE).
-
persistenceModifier
protected FieldPersistenceModifier persistenceModifier
persistence-modifier tag value.
-
primaryKey
protected Boolean primaryKey
primary key tag value.
-
table
protected String table
Table name for this field.
-
catalog
protected String catalog
Catalog for the table specified for this field.
-
schema
protected String schema
Schema for the table specified for this field.
-
valueStrategy
protected ValueGenerationStrategy valueStrategy
The value-strategy attribute specifies the strategy used to generate values for the field. This attribute has the same values and meaning as the strategy attribute in datastoreidentity.
-
valueGeneratorName
protected String valueGeneratorName
Name of a value generator if the user wants to override the default generator.
-
sequence
protected String sequence
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.
-
className
protected String className
Name of the class to which this field really belongs. Will be null if the field belongs to the parent ClassMetaData, and will have a value if it is an overriding field.
-
fullFieldName
protected String fullFieldName
Cache result ofgetFullFieldName()
.
-
type
protected Class type
Field type being represented.
-
memberRepresented
protected Member memberRepresented
The member (field/method) being represented here. Note, this prevents Serialization.
-
fieldId
protected int fieldId
Id of the field in its class (only for fields that are managed). If the value is -1, the field is NOT managed or the object hasn't been populated.
-
relationType
protected RelationType relationType
The relation type of this field (1-1, 1-N, M-N, N-1).
-
relatedMemberMetaData
protected AbstractMemberMetaData[] relatedMemberMetaData
MetaData for the other end of a relation when this member is a bidirectional relation. This may be multiple fields if the FK is shared.
-
ordered
protected boolean ordered
Temporary flag to signify if the field is ordered.
-
columns
protected List<ColumnMetaData> columns
Columns ColumnMetaData
-
targetClassName
protected String targetClassName
Name of the target entity (when used with JPA MetaData on OneToOne, OneToMany etc)
-
storeInLob
protected boolean storeInLob
Wrapper for the ugly JPA "lob" so that when being populated we should make this serialised in some way.
-
mapsIdAttribute
protected String mapsIdAttribute
Placeholder for the JPA "mapsId" attribute, in case a store plugin wants to use it
-
relationTypeString
protected String relationTypeString
Placeholder for the JPA relation type ManyToOne, OneToOne etc so we can store what the user specified.
-
persistenceFlags
protected byte persistenceFlags
Flags for use in enhancement process [see JDO spec 21.14]
-
EXTENSION_MEMBER_FETCH_FK_ONLY
public static final String EXTENSION_MEMBER_FETCH_FK_ONLY
Member : whether to fetch just the FK (and not populate the related object). Equates to fetching the field with recursion-depth=0- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractMemberMetaData
public AbstractMemberMetaData(MetaData parent, AbstractMemberMetaData mmd)
Convenience constructor to copy the specification from the passed member. This is used when we have an overriding field and we make a copy of the baseline member as a starting point.- Parameters:
parent
- The parentmmd
- The member metadata to copy
-
-
Method Detail
-
populate
public void populate(ClassLoaderResolver clr, Field field, Method method, ClassLoader primary, MetaDataManager mmgr)
Method to provide the details of the field being represented by this MetaData hence populating certain parts of the MetaData. This is 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 specifed that are inconsistent with the field being represented. Either a field or a method should be passed in (one or the other) depending on what is being represented by this "member".- Parameters:
clr
- ClassLoaderResolver to use for any class loadingfield
- Field that we are representing (if it's a field)method
- Method(property) that we are representing (if it's a method).primary
- the primary ClassLoader to use (or null)mmgr
- MetaData manager
-
getPackageName
public String getPackageName()
-
getDefaultFieldPersistenceModifier
public final FieldPersistenceModifier getDefaultFieldPersistenceModifier(Class c, int modifier, boolean isPCclass, MetaDataManager mmgr)
Accessor for the default "persistence-modifier" for a field given the class, its modifier and whether it is a Persistable class.- Parameters:
c
- The classmodifier
- The modifiers for the fieldisPCclass
- Whether it is persistence capable.mmgr
- MetaData manager- Returns:
- The default field PersistenceModifier.
-
initialise
public void initialise(ClassLoaderResolver clr)
Initialisation method. This should be called AFTER using the populate method if you are going to use populate. It creates the internal convenience arrays etc needed for normal operation.- Overrides:
initialise
in classMetaData
-
isFieldArrayTypePersistable
public boolean isFieldArrayTypePersistable(MetaDataManager mmgr)
Utility to return if this array field has elements that are Persistable. Not valid for use by the enhancer. Must be overridden for that mode. If the field is not an array will return false.- Parameters:
mmgr
- MetaData manager- Returns:
- Whether the field type is persistable. TODO Move this out into a org.datanucleus.store.types class
-
isStatic
public boolean isStatic()
Convenience method to return if this field/property is static. When the object is not "populated" always returns false;- Returns:
- Whether the field/property is static
-
isFinal
public boolean isFinal()
Convenience method to return if this field/property is final. When the object is not "populated" always returns false;- Returns:
- Whether the field is field/property
-
isTransient
public boolean isTransient()
Convenience method to return if this field/property is transient. When the object is not "populated" always returns false;- Returns:
- Whether the field/property is transient
-
isPublic
public boolean isPublic()
Convenience method to return if this field/property is public. When the object is not "populated" always returns false;- Returns:
- Whether the field/property is public
-
isProtected
public boolean isProtected()
Convenience method to return if this field/property is protected. When the object is not "populated" always returns false;- Returns:
- Whether the field/property is protected
-
isPrivate
public boolean isPrivate()
Convenience method to return if this field/property is private. When the object is not "populated" always returns false;- Returns:
- Whether the field/property is private
-
isAbstract
public boolean isAbstract()
Convenience method to return if this field represents an abstract property.- Returns:
- Whether the property is abstract
-
getValueStrategy
public ValueGenerationStrategy getValueStrategy()
-
setValueStrategy
public void setValueStrategy(ValueGenerationStrategy valueStrategy)
-
setValueStrategy
public void setValueStrategy(String strategy)
-
getValueGeneratorName
public String getValueGeneratorName()
Name of a (user-provided) value generator to override the default generator for this strategy.- Returns:
- Name of user provided value generator
-
getSequence
public String getSequence()
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.- Returns:
- the sequence name
-
setSequence
public void setSequence(String sequence)
If the value-strategy is sequence, the sequence attribute specifies the name of the sequence to use to automatically generate a value for the field.- Parameters:
sequence
- the sequence name
-
isCacheable
public boolean isCacheable()
-
setCacheable
public void setCacheable(boolean cache)
-
getLoadFetchGroup
public String getLoadFetchGroup()
-
setLoadFetchGroup
public void setLoadFetchGroup(String loadFetchGroup)
-
getTypeConverterName
public String getTypeConverterName()
-
setTypeConverterName
public void setTypeConverterName(String name)
-
isTypeConversionDisabled
public boolean isTypeConversionDisabled()
-
setTypeConverterDisabled
public void setTypeConverterDisabled()
-
getRecursionDepth
public Integer getRecursionDepth()
-
setRecursionDepth
public void setRecursionDepth(int depth)
-
setRecursionDepth
public void setRecursionDepth(String depth)
-
addExtensions
public MetaData addExtensions(Map<String,String> exts)
- Overrides:
addExtensions
in classMetaData
-
setExtensions
public MetaData setExtensions(Map<String,String> exts)
- Overrides:
setExtensions
in classMetaData
-
addExtension
public MetaData addExtension(String key, String value)
- Overrides:
addExtension
in classMetaData
-
getOverallParentClassMetaData
protected static MetaData getOverallParentClassMetaData(MetaData metadata)
Convenience method to navigate back through the parents to find the overall ClassMetaData handling this object. This is to cater specifically for nested embedded fields where you can nest object several levels deep.- Parameters:
metadata
- The metadata to check- Returns:
- The overall class metadata for this element
-
getAbstractClassMetaData
public AbstractClassMetaData getAbstractClassMetaData()
Convenience accessor for the MetaData of the parent class.- Returns:
- Returns the MetaData of the parent class.
-
getOrderMetaData
public final OrderMetaData getOrderMetaData()
Accessor for orderMetaData- Returns:
- Returns the orderMetaData.
-
getName
public String getName()
Accessor for the field name- Returns:
- field name
-
getFullFieldName
public String getFullFieldName()
Accessor for the full field name. This prepends the class name.- Returns:
- full field name.
-
fieldBelongsToClass
public boolean fieldBelongsToClass()
Accessor for whether the field is for a superclass, and not for this class.- Returns:
- Whether the field belongs to a superclass
-
getClassName
public String getClassName()
Accessor for the fully-qualified class name owning this field.- Returns:
- The class name
-
getClassName
public String getClassName(boolean fully_qualified)
Convenience to return the class name that this a field of.- Parameters:
fully_qualified
- Whether the name should be fully qualified.- Returns:
- Class name
-
getPersistenceModifier
public FieldPersistenceModifier getPersistenceModifier()
-
setPersistenceModifier
public void setPersistenceModifier(FieldPersistenceModifier modifier)
-
setNotPersistent
public void setNotPersistent()
-
setTransactional
public void setTransactional()
-
isDefaultFetchGroup
public boolean isDefaultFetchGroup()
-
setDefaultFetchGroup
public void setDefaultFetchGroup(boolean dfg)
-
isEmbedded
public boolean isEmbedded()
-
setEmbedded
public void setEmbedded(boolean val)
-
isSerialized
public boolean isSerialized()
-
setSerialised
public void setSerialised(boolean flag)
-
getMapsIdAttribute
public String getMapsIdAttribute()
-
isDependent
public boolean isDependent()
-
setDependent
public void setDependent(boolean dependent)
-
isCascadePersist
public boolean isCascadePersist()
Accessor for the whether this field should be cascaded at persist.- Returns:
- Whether to cascade at persist
-
isCascadeDelete
public boolean isCascadeDelete()
Accessor for the whether this field should be cascaded at delete.- Returns:
- Whether to cascade at delete
-
isCascadeAttach
public boolean isCascadeAttach()
Accessor for the whether this field should be cascaded at attach.- Returns:
- Whether to cascade at attach
-
isCascadeDetach
public boolean isCascadeDetach()
Accessor for the whether this field should be cascaded at detach.- Returns:
- Whether to cascade at detach
-
isCascadeRefresh
public boolean isCascadeRefresh()
Accessor for the whether this field should be cascaded at refresh.- Returns:
- Whether to cascade at refresh
-
isCascadeRemoveOrphans
public boolean isCascadeRemoveOrphans()
Accessor for the whether this field should remove orphans at delete.- Returns:
- Whether to remove orphans at delete
-
setCascadePersist
public void setCascadePersist(boolean cascade)
Mutator for the cascading of persist operations on this field.- Parameters:
cascade
- Whether to cascade at persist
-
setCascadeAttach
public void setCascadeAttach(boolean cascade)
Mutator for the cascading of attach operations on this field.- Parameters:
cascade
- Whether to cascade at attach
-
setCascadeDelete
public void setCascadeDelete(boolean cascade)
Mutator for the cascading of delete operations on this field.- Parameters:
cascade
- Whether to cascade at delete
-
setCascadeDetach
public void setCascadeDetach(boolean cascade)
Mutator for the cascading of detach operations on this field.- Parameters:
cascade
- Whether to cascade at detach
-
setCascadeRefresh
public void setCascadeRefresh(boolean cascade)
Mutator for the cascading of refresh operations on this field.- Parameters:
cascade
- Whether to cascade at refresh
-
setCascadeRemoveOrphans
public void setCascadeRemoveOrphans(boolean cascade)
Mutator for the cascading of orphan removal operations on this field.- Parameters:
cascade
- Whether to remove orphans on remove
-
isPrimaryKey
public boolean isPrimaryKey()
-
setPrimaryKey
public AbstractMemberMetaData setPrimaryKey(boolean flag)
-
isCreateUser
public boolean isCreateUser()
-
isCreateTimestamp
public boolean isCreateTimestamp()
-
isUpdateUser
public boolean isUpdateUser()
-
isUpdateTimestamp
public boolean isUpdateTimestamp()
-
setColumn
public AbstractMemberMetaData setColumn(String col)
-
getTable
public String getTable()
-
setTable
public AbstractMemberMetaData setTable(String table)
-
getCatalog
public String getCatalog()
-
setCatalog
public AbstractMemberMetaData setCatalog(String catalog)
-
getSchema
public String getSchema()
-
setSchema
public AbstractMemberMetaData setSchema(String schema)
-
isUnique
public boolean isUnique()
-
setUnique
public AbstractMemberMetaData setUnique(String unique)
-
setUnique
public AbstractMemberMetaData setUnique(boolean unique)
-
getIndexed
public IndexedValue getIndexed()
-
setIndexed
public AbstractMemberMetaData setIndexed(IndexedValue val)
-
getNullValue
public NullValue getNullValue()
-
setNullValue
public AbstractMemberMetaData setNullValue(NullValue val)
-
getFieldId
public int getFieldId()
Accessor for the field id. Not set when the field is an overriding field.- Returns:
- field id
-
getFieldTypes
public final String[] getFieldTypes()
Accessor for the implementation type(s) that can be stored in this field when it is a reference type.- Returns:
- Returns the implementation type(s) for the field.
-
setFieldTypes
public void setFieldTypes(String types)
Mutator for the possible field type(s) that this reference field can store.- Parameters:
types
- The types (comma-separated)
-
getAbsoluteFieldNumber
public int getAbsoluteFieldNumber()
Accessor for the absolute field id- Returns:
- field id
-
getMemberRepresented
public Member getMemberRepresented()
Accessor for the member being represented.- Returns:
- The member
-
getType
public Class getType()
Accessor for the field type- Returns:
- Reflection field type
-
getTypeName
public String getTypeName()
Accessor for the field type name- Returns:
- Reflection field type name
-
getContainer
public ContainerMetaData getContainer()
Accessor for the container for this field.- Returns:
- The MetaData of the container for this field.
-
getArray
public ArrayMetaData getArray()
Accessor for an array container for this field. Returns null if no array attached.- Returns:
- The MetaData of the container for this field if an array
-
getCollection
public CollectionMetaData getCollection()
Accessor for a collection container for this field. Returns null if no collection present.- Returns:
- The MetaData of the container for this field if a Collection.
-
getMap
public MapMetaData getMap()
Accessor for a map container for this field. Returns null if no map present.- Returns:
- The MetaData of the container for this field if a Map.
-
hasContainer
public boolean hasContainer()
Accessor for whether the field has a container.- Returns:
- Whether it represents a container.
-
hasArray
public boolean hasArray()
Accessor for whether the field has an array- Returns:
- return true if has array
-
hasCollection
public boolean hasCollection()
Accessor for whether the field has a collection- Returns:
- return true if has collection
-
isSingleCollection
public boolean isSingleCollection()
Accessor for whether the field has a collection that holds only one element.- Returns:
- Whether this is a collection with single element
-
hasMap
public boolean hasMap()
Accessor for whether the field has a map.- Returns:
- return true if has map
-
getColumnMetaData
public final ColumnMetaData[] getColumnMetaData()
Acessor for the columns- Specified by:
getColumnMetaData
in interfaceColumnMetaDataContainer
- Returns:
- Returns the columnMetaData.
-
getElementMetaData
public final ElementMetaData getElementMetaData()
Accessor for elementMetaData- Returns:
- Returns the elementMetaData.
-
getKeyMetaData
public final KeyMetaData getKeyMetaData()
Accessor for keyMetaData- Returns:
- Returns the keyMetaData.
-
getValueMetaData
public final ValueMetaData getValueMetaData()
Accessor for valueMetaData- Returns:
- Returns the valueMetaData.
-
getEmbeddedMetaData
public final EmbeddedMetaData getEmbeddedMetaData()
Accessor for embeddedMetaData- Returns:
- Returns the embeddedMetaData.
-
getMappedBy
public final String getMappedBy()
-
setMappedBy
public void setMappedBy(String mappedBy)
-
setDeleteAction
public void setDeleteAction(String action)
-
getForeignKeyMetaData
public final ForeignKeyMetaData getForeignKeyMetaData()
Accessor for foreignKeyMetaData- Returns:
- Returns the foreignKeyMetaData.
-
getIndexMetaData
public final IndexMetaData getIndexMetaData()
Accessor for indexMetaData- Returns:
- Returns the indexMetaData.
-
getUniqueMetaData
public final UniqueMetaData getUniqueMetaData()
Accessor for uniqueMetaData- Returns:
- Returns the uniqueMetaData.
-
getJoinMetaData
public final JoinMetaData getJoinMetaData()
Accessor for joinMetaData- Returns:
- Returns the joinMetaData.
-
addColumn
public void addColumn(ColumnMetaData colmd)
Add a new ColumnMetaData element- Specified by:
addColumn
in interfaceColumnMetaDataContainer
- Parameters:
colmd
- the ColumnMetaData to add
-
clearColumns
public void clearColumns()
-
newColumnMetaData
public ColumnMetaData newColumnMetaData()
-
getPersistenceFlags
public byte getPersistenceFlags()
Accessor for the persistence flags- Returns:
- Persistence flags (for enhancing)
-
isFieldToBePersisted
public boolean isFieldToBePersisted()
Accessor for whether the field is to be persisted by the persistence process. Currently omits static and final fields, and fields explicitly marked as not persistent.- Returns:
- Whether it is managed
-
isOrdered
public boolean isOrdered()
-
getTargetClassName
public String getTargetClassName()
-
setOrdered
public void setOrdered()
Mutator for whether the collection stored in this field is ordered. Only valid until the metadata is initialised.
-
setTargetClassName
public void setTargetClassName(String target)
Mutator for the target class name. Only valid until the metadata is initialised.- Parameters:
target
- Target class name
-
setStoreInLob
public void setStoreInLob()
Mutator for whetehr to store as a "lob".
-
setMapsIdAttribute
public void setMapsIdAttribute(String attr)
-
setRelationTypeString
public void setRelationTypeString(String relType)
-
getRelationTypeString
public String getRelationTypeString()
-
setValueGeneratorName
public void setValueGeneratorName(String generator)
Mutator for the name of the value generator to use for this strategy.- Parameters:
generator
- Name of value generator
-
setContainer
public void setContainer(ContainerMetaData conmd)
Method to set the container for this field (if this field represents a container (collection, map, array).- Parameters:
conmd
- The MetaData of the container for this field.
-
newCollectionMetaData
public CollectionMetaData newCollectionMetaData()
Method to create a new collection metadata, set it, and return it.- Returns:
- The collection metadata
-
newArrayMetaData
public ArrayMetaData newArrayMetaData()
Method to create a new array metadata, set it, and return it.- Returns:
- The array metadata
-
newMapMetaData
public MapMetaData newMapMetaData()
Method to create a new map metadata, set it, and return it.- Returns:
- The map metadata
-
setElementMetaData
public final void setElementMetaData(ElementMetaData elementMetaData)
Mutator for the element MetaData- Parameters:
elementMetaData
- The elementMetaData to set.
-
newElementMetaData
public ElementMetaData newElementMetaData()
Method to create a new element metadata, set it, and return it.- Returns:
- The element metadata
-
setKeyMetaData
public final void setKeyMetaData(KeyMetaData keyMetaData)
Mutator for the key MetaData- Parameters:
keyMetaData
- The keyMetaData to set.
-
newKeyMetaData
public KeyMetaData newKeyMetaData()
Method to create a new key metadata, set it, and return it.- Returns:
- The key metadata
-
setValueMetaData
public final void setValueMetaData(ValueMetaData valueMetaData)
Mutator for the value MetaData- Parameters:
valueMetaData
- The valueMetaData to set.
-
newValueMetaData
public ValueMetaData newValueMetaData()
Method to create a new value metadata, set it, and return it.- Returns:
- The value metadata
-
setOrderMetaData
public final void setOrderMetaData(OrderMetaData orderMetaData)
Mutator for the order MetaData- Parameters:
orderMetaData
- The orderMetaData to set.
-
newOrderMetaData
public OrderMetaData newOrderMetaData()
Method to create a new order metadata, set it, and return it.- Returns:
- The order metadata
-
setEmbeddedMetaData
public final void setEmbeddedMetaData(EmbeddedMetaData embeddedMetaData)
Mutator for the embedded MetaData- Parameters:
embeddedMetaData
- The embeddedMetaData to set.
-
newEmbeddedMetaData
public EmbeddedMetaData newEmbeddedMetaData()
Method to create a new embedded metadata, set it, and return it.- Returns:
- The embedded metadata
-
setForeignKeyMetaData
public final void setForeignKeyMetaData(ForeignKeyMetaData foreignKeyMetaData)
Mutator for the foreignKey MetaData- Parameters:
foreignKeyMetaData
- The foreignKeyMetaData to set.
-
newForeignKeyMetaData
public ForeignKeyMetaData newForeignKeyMetaData()
Method to create a new FK metadata, set it, and return it.- Returns:
- The FK metadata
-
setIndexMetaData
public final void setIndexMetaData(IndexMetaData indexMetaData)
Mutator for the index MetaData- Parameters:
indexMetaData
- The indexMetaData to set.
-
newIndexMetaData
public IndexMetaData newIndexMetaData()
Method to create a new index metadata, set it, and return it.- Returns:
- The index metadata
-
setUniqueMetaData
public final void setUniqueMetaData(UniqueMetaData uniqueMetaData)
Mutator for the unique MetaData- Parameters:
uniqueMetaData
- The uniqueMetaData to set.
-
newUniqueMetaData
public UniqueMetaData newUniqueMetaData()
Method to create a new unique metadata, set it, and return it.- Returns:
- The unique metadata
-
setJoinMetaData
public final void setJoinMetaData(JoinMetaData joinMetaData)
Mutator for the join MetaData- Parameters:
joinMetaData
- The joinMetaData to set.
-
newJoinMetaData
public JoinMetaData newJoinMetaData()
Method to create a new join metadata, set it, and return it.- Returns:
- The join metadata
-
setRelation
protected void setRelation(ClassLoaderResolver clr)
Convenience method that sets up the relation type of this field, and the reference to any related field when it is bidirectional. If the relation is bidirectional then will also set the other side of the relation (to relate to this side). Any member that refers to a PERSISTENT INTERFACE will have relation type as NONE. This should ultimately be changed to reflect the real relation, and relationMemberMetaData should also be set accordingly.- Parameters:
clr
- ClassLoader resolver- Throws:
NucleusUserException
- If mapped-by doesnt exist at other side
-
getRelationType
public RelationType getRelationType(ClassLoaderResolver clr)
Accessor for the relation type for this field.- Parameters:
clr
- ClassLoader resolver- Returns:
- The relation type.
-
isPersistentInterface
public boolean isPersistentInterface(ClassLoaderResolver clr)
Convenience method to return if this member relates to a persistent interface. All members that have a relation will return NONE from getRelationType but can be accessed through here. TODO Merge this with relation methods so we only need the relationType/relatedMemberMetaData.- Parameters:
clr
- ClassLoader resolver- Returns:
- Whether it is for a persistent interface
-
isRelationOwner
public boolean isRelationOwner(ClassLoaderResolver clr)
Convenience method for whether this field is the owner of the relation. If the field has no relation will return true. If the field is in a unidirectional relation will return true. If the field is in a bidirectional relation and has no mapped-by will return true. Otherwise returns false.- Parameters:
clr
- ClassLoader resolver- Returns:
- Whether it is the owner side of a relation
-
getRelatedMemberMetaData
public AbstractMemberMetaData[] getRelatedMemberMetaData(ClassLoaderResolver clr)
Accessor for the FieldMetaData of any related field/property (where this field is part of a bidirectional relation). Allows for 1-1, 1-N, and M-N. If this field is not part of a bidirectional relation (no "mapped-by" at either end) then it returns null.- Parameters:
clr
- the ClassLoaderResolver- Returns:
- The MetaData for the field/property at the "other end".
-
getRelatedMemberMetaDataForObject
public AbstractMemberMetaData getRelatedMemberMetaDataForObject(ClassLoaderResolver clr, Object thisPC, Object otherPC)
Convenience accessor for the MetaData for the field/property at the other side of the bidirectional relation given the objects at this side and the other side. TODO Note that this only applies to 1-1, N-1 fields currently- Parameters:
clr
- ClassLoader ResolverthisPC
- This objectotherPC
- The related object- Returns:
- The MetaData for the field in the related object
-
calcIsSecondClassMutable
public boolean calcIsSecondClassMutable(MetaDataManager mmgr)
Calculate whether this field should be a second class mutable field. Allows override via extension "is-second-class", otherwise uses TypeManager.isSecondClassMutable(). Please note that this data will be cached inAbstractClassMetaData.scoMutableMemberFlags
.- Parameters:
mmgr
- MetaData manager- Returns:
- whether this field should be regarded as a second class mutable field.
-
isInsertable
public boolean isInsertable()
Convenience method to return if the field/property is insertable.- Returns:
- Whether we are allowed to insert it
-
isUpdateable
public boolean isUpdateable()
Convenience method to return if the field/property is updateable.- Returns:
- Whether we are allowed to update it
-
compareTo
public int compareTo(Object o)
Comparator method. This allows the ClassMetaData to search for an AbstractMemberMetaData with a particular name.- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- The object to compare against- Returns:
- The comparison result
-
-