Class ClassMetaData

    • Field Detail

      • ID_DATASTORE

        public static final int ID_DATASTORE
        Datastore identity type.
        See Also:
        Constant Field Values
      • ID_APPLICATION

        public static final int ID_APPLICATION
        Application identity type.
        See Also:
        Constant Field Values
      • ACCESS_UNKNOWN

        public static final int ACCESS_UNKNOWN
        Unknown access type.
      • ACCESS_FIELD

        public static final int ACCESS_FIELD
        Persistent attributes are accessed via direct field access. Bit flag.
      • ACCESS_PROPERTY

        public static final int ACCESS_PROPERTY
        Persistent attributes are accessed via setters and getters. Bit flag.
      • ACCESS_EXPLICIT

        public static final int ACCESS_EXPLICIT
        Persistent class has explicitly defined an access type. This will allow the attributes to use mixed access i.e. some field may use ACCESS_FIELD while others ACCESS_PROPERTY.
      • SYNTHETIC

        public static final java.lang.String SYNTHETIC
        Value for using a synthetic detached state field, which is the default.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ClassMetaData

        protected ClassMetaData​(java.lang.Class<?> type,
                                MetaDataRepository repos)
        Constructor. Supply described type and repository.
      • ClassMetaData

        protected ClassMetaData​(ValueMetaData owner)
        Embedded constructor. Supply embedding value.
    • Method Detail

      • getEmbeddingMetaData

        public ValueMetaData getEmbeddingMetaData()
        If this metadata is for an embedded object, returning the owning value.
      • getDescribedType

        public java.lang.Class<?> getDescribedType()
        The persistence capable class described by this metadata.
      • getDescribedTypeString

        public java.lang.String getDescribedTypeString()
        The persistence capable stringified class described by this metadata.
      • setDescribedType

        protected void setDescribedType​(java.lang.Class<?> type)
        Set the class described by this metadata. The type may be reset when an embedded value changes its declared type.
      • getEnvClassLoader

        public java.lang.ClassLoader getEnvClassLoader()
        The environmental loader used when loading this metadata. The class metadata should use this loader when loading metadata for its superclass and field types.
      • setEnvClassLoader

        public void setEnvClassLoader​(java.lang.ClassLoader loader)
        The class environmental loader used when loading this metadata. The class metadata should use this loader when loading metadata for its superclass and field types.
      • getPCSuperclass

        public java.lang.Class<?> getPCSuperclass()
        The persistence capable superclass of the described type.
      • setPCSuperclass

        public void setPCSuperclass​(java.lang.Class<?> pc)
        The persistence capable superclass of the described type.
      • getPCSuperclassMetaData

        public ClassMetaData getPCSuperclassMetaData()
        The metadata for this class' superclass.
      • setPCSuperclassMetaData

        public void setPCSuperclassMetaData​(ClassMetaData meta)
        The metadata for this class' superclass.
      • isMapped

        public boolean isMapped()
        Whether this class is mapped to the datastore. By default, only returns false if class is embedded-only, but subclasses might override to allow unmapped other types.
      • getMappedPCSuperclassMetaData

        public ClassMetaData getMappedPCSuperclassMetaData()
        Return the closest mapped superclass.
      • getPCSubclasses

        public java.lang.Class<?>[] getPCSubclasses()
        Return the known persistence capable subclasses of the described type, or empty array if none or if this is embedded metadata.
      • getPCSubclassMetaDatas

        public ClassMetaData[] getPCSubclassMetaDatas()
        Return the metadata for the known persistence capable subclasses of the described type, or empty array if none or if this is embedded metadata.
      • getMappedPCSubclassMetaDatas

        public ClassMetaData[] getMappedPCSubclassMetaDatas()
        Return all mapped subclasses.
      • getIdentityType

        public int getIdentityType()
        The type of identity being used. This will be one of:
        • ID_UNKNOWN: unknown identity type
        • ID_DATASTORE: identity managed by the data store and independent of the fields of the instance
        • ID_APPLICATION: identity managed by the application and defined by one or more fields of the instance
        If unspecified, defaults to ID_DATASTORE if there are no primary key fields, and ID_APPLICATION otherwise.
      • setIdentityType

        public void setIdentityType​(int type)
        The type of identity being used. This will be one of:
        • ID_UNKNOWN: unknown identity type
        • ID_DATASTORE: identity managed by the data store and independent of the fields of the instance
        • ID_APPLICATION: identity managed by the application and defined by one or more fields of the instance
        If unspecified, defaults to ID_DATASTORE if there are no primary key fields, and ID_APPLICATION otherwise.
      • getObjectIdType

        public java.lang.Class<?> getObjectIdType()
        The metadata-specified class to use for the object ID.
      • setObjectIdType

        public void setObjectIdType​(java.lang.Class<?> cls,
                                    boolean shared)
        The metadata-specified class to use for the object ID. When there is IdClass annotation, AnnotationMetaDataParser will call this method to set ObjectId type. However, if this is a derived identity in the child entity where a relation field (parent entity) is used as an id, and this relation field has an IdClass, the IdClass annotation in the child entity can be ignored as Openjpa will automatically wrap parent's IdClass as child's IdClass.
      • isObjectIdTypeShared

        public boolean isObjectIdTypeShared()
        Whether this type uses an application identity class that is shared with other classes, and is therefore wrapped in an ObjectId.
      • isOpenJPAIdentity

        public boolean isOpenJPAIdentity()
        Whether this type uses OpenJPA identity.
      • getIdentityStrategy

        public int getIdentityStrategy()
        The strategy to use for datastore identity generation. One of the constants from ValueStrategies.
      • setIdentityStrategy

        public void setIdentityStrategy​(int strategy)
        The strategy to use for datastore identity generation. One of the constants from ValueStrategies.
      • getIdentitySequenceName

        public java.lang.String getIdentitySequenceName()
        The datastore identity sequence name, or null for none.
      • setIdentitySequenceName

        public void setIdentitySequenceName​(java.lang.String seqName)
        The datastore identity sequence name, or null for none.
      • getIdentitySequenceMetaData

        public SequenceMetaData getIdentitySequenceMetaData()
        Metadata for the datastore identity sequence.
      • getLifecycleMetaData

        public LifecycleMetaData getLifecycleMetaData()
        Information about lifecycle callbacks for this class.
      • getTypeAlias

        public java.lang.String getTypeAlias()
        Returns the alias for the described type, or null if none has been set.
        See Also:
        setTypeAlias(java.lang.String)
      • setTypeAlias

        public void setTypeAlias​(java.lang.String alias)
        Sets the alias for the described type. The alias can be any arbitrary string that the implementation can later use to refer to the class. Note that at runtime, only the alias computed when the persistent type was enhanced is used.
        Parameters:
        alias - the alias name to apply to the described type
      • getAccessType

        public int getAccessType()
        The access type used by this class.
      • setAccessType

        public void setAccessType​(int type)
        Sets the access type.
      • isExplicitAccess

        public boolean isExplicitAccess()
        Affirms if access style is explicitly defined.
      • isMixedAccess

        public boolean isMixedAccess()
        Affirms if attributes of this class use mixed access types.
      • getRequiresExtent

        public boolean getRequiresExtent()
        Whether the type requires extent management.
      • setRequiresExtent

        public void setRequiresExtent​(boolean req)
        Whether the type requires extent management.
      • isEmbeddedOnly

        public boolean isEmbeddedOnly()
        Whether the type can only be used as an embedded object.
      • setEmbeddedOnly

        public void setEmbeddedOnly​(boolean embed)
        Whether the type can only be used as an embedded object.
      • isEmbeddable

        public boolean isEmbeddable()
      • setEmbeddable

        public void setEmbeddable()
      • isIntercepting

        public boolean isIntercepting()
        Whether the type's fields are actively intercepted, either by redefinition or enhancement.
      • setIntercepting

        public void setIntercepting​(boolean intercepting)
        Whether the type's fields are actively intercepted, either by redefinition or enhancement.
      • isManagedInterface

        public boolean isManagedInterface()
        Whether the type is a managed interface.
      • setManagedInterface

        public void setManagedInterface​(boolean managedInterface)
        Whether the type is a managed interface
      • getInterfaceImpl

        public java.lang.Class<?> getInterfaceImpl()
        Return the managed interface implementor if any.
      • setInterfaceImpl

        public void setInterfaceImpl​(java.lang.Class<?> impl)
        Set the managed interface implementor class.
      • getDeclaredInterfaces

        public java.lang.Class<?>[] getDeclaredInterfaces()
        Return all explicitly declared interfaces this class implements.
      • addDeclaredInterface

        public void addDeclaredInterface​(java.lang.Class<?> iface)
        Explicitly declare the given interface among the ones this class implements.
      • removeDeclaredInterface

        public boolean removeDeclaredInterface​(java.lang.Class<?> iface)
        Remove the given interface from the declared list.
      • setInterfacePropertyAlias

        public void setInterfacePropertyAlias​(java.lang.Class<?> iface,
                                              java.lang.String orig,
                                              java.lang.String local)
        Alias properties from the given interface during queries to the local field.
      • getInterfacePropertyAlias

        public java.lang.String getInterfacePropertyAlias​(java.lang.Class<?> iface,
                                                          java.lang.String orig)
        Get local field alias for the given interface property.
      • getInterfaceAliasedProperties

        public java.lang.String[] getInterfaceAliasedProperties​(java.lang.Class<?> iface)
        Return all aliases property named for the given interface.
      • getExtraFieldDataLength

        public int getExtraFieldDataLength()
        Return the number of fields that use impl or intermediate data, in order to create a compacted array for storage of said data.
      • getExtraFieldDataIndex

        public int getExtraFieldDataIndex​(int field)
        Return the intermediate field data index of the given field in the compacted array, or -1 if the field does not use extra data.
        See Also:
        getExtraFieldDataLength()
      • isAccessibleField

        public boolean isAccessibleField​(java.lang.String field)
        Return whether the given name represents a managed or static field of this class, including superclass fields.
      • getProxyFields

        public FieldMetaData[] getProxyFields()
        Return all fields that are types that need to be wrappered by a proxy. The types that need to be proxied are:

      • org.apache.openjpa.meta.JavaTypes.CALENDAR
      • org.apache.openjpa.meta.JavaTypes.COLLECTION
      • org.apache.openjpa.meta.JavaTypes.DATE
      • org.apache.openjpa.meta.JavaTypes.MAP
      • org.apache.openjpa.meta.JavaTypes.OBJECT