Class 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 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.
      • 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).
      • 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.
      • 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.
      • 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 parent
        mmd - The member metadata to copy
      • AbstractMemberMetaData

        public AbstractMemberMetaData​(MetaData parent,
                                      String name)
        Constructor for a fields metadata. Set the fields using setters, before populate().
        Parameters:
        parent - parent MetaData instance TODO Remove this
        name - field/property name
    • 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 loading
        field - 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 class
        modifier - The modifiers for the field
        isPCclass - 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 class MetaData
      • 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
      • 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)
      • 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
      • 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()
      • isCreateUser

        public boolean isCreateUser()
      • isCreateTimestamp

        public boolean isCreateTimestamp()
      • isUpdateUser

        public boolean isUpdateUser()
      • isUpdateTimestamp

        public boolean isUpdateTimestamp()
      • getTable

        public String getTable()
      • getCatalog

        public String getCatalog()
      • getSchema

        public String getSchema()
      • isUnique

        public boolean isUnique()
      • getNullValue

        public NullValue getNullValue()
      • 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
      • 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.
      • clearColumns

        public void clearColumns()
      • 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 Resolver
        thisPC - This object
        otherPC - 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 in AbstractClassMetaData.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 interface Comparable
        Parameters:
        o - The object to compare against
        Returns:
        The comparison result