Package org.datanucleus.api.jdo.metadata
Class JDOAnnotationUtils
java.lang.Object
org.datanucleus.api.jdo.metadata.JDOAnnotationUtils
Series of utility methods for converting between annotations and metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addExtensionsToMetaData
(org.datanucleus.metadata.MetaData metadata, javax.jdo.annotations.Extension[] extensions) Convenience method to add extensions to a metadata element.static org.datanucleus.metadata.ColumnMetaData
getColumnMetaDataForAnnotations
(Map<String, Object> annotationValues) Convenience method to get the column metadata for annotation values of a @Column.static org.datanucleus.metadata.ColumnMetaData
getColumnMetaDataForColumnAnnotation
(javax.jdo.annotations.Column col) Convenience method to get the column metadata for a Column annotation.static String
getDiscriminatorStrategyString
(javax.jdo.annotations.DiscriminatorStrategy strategy) Convenience accessor for the string name of a discriminator strategy.static org.datanucleus.metadata.FieldPersistenceModifier
getFieldPersistenceModifier
(javax.jdo.annotations.PersistenceModifier modifier) Convenience accessor for the persistence-modifier on a field.static org.datanucleus.metadata.ForeignKeyMetaData
getFKMetaData
(String name, String table, String unique, String deferred, String deleteAction, String updateAction, String[] fields, javax.jdo.annotations.Column[] columns) Convenience method to create a ForeignKeyMetaData from the annotations data.static String
getForeignKeyActionString
(javax.jdo.annotations.ForeignKeyAction action) Convenience accessor for the string name of a FK action.static String
getIdentityTypeString
(javax.jdo.annotations.IdentityType idType) Convenience accessor for the string name of the identity type.static org.datanucleus.metadata.IndexMetaData
getIndexMetaData
(String name, String table, String unique, String[] fields, javax.jdo.annotations.Column[] columns) Convenience method to create an IndexMetaData from the annotations data.static String
getInheritanceStrategyString
(javax.jdo.annotations.InheritanceStrategy strategy) Convenience accessor for the string name of an inheritance strategy.static String
getNullValueString
(javax.jdo.annotations.NullValue value) Convenience accessor for the string name of a null value action.static String
getQueryLanguageName
(String value) Convenience accessor for the query language to a valid internal value.static String
getSequenceStrategyString
(javax.jdo.annotations.SequenceStrategy strategy) Convenience accessor for the string name of a datastore sequence strategy.static org.datanucleus.metadata.UniqueMetaData
getUniqueMetaData
(String name, String table, String deferred, String[] fields, javax.jdo.annotations.Column[] columns) Convenience method to create a UniqueMetaData from the annotations data.static String
getValueGenerationStrategyString
(javax.jdo.annotations.IdGeneratorStrategy strategy) Convenience accessor for the string name of a id generator strategy (from JDO annotations).static String
getVersionStrategyString
(javax.jdo.annotations.VersionStrategy strategy) Convenience accessor for the string name of a version strategy.
-
Field Details
-
PERSISTENCE_CAPABLE
-
PERSISTENCE_AWARE
-
EMBEDDED_ONLY
-
VERSION
-
DATASTORE_IDENTITY
-
PRIMARY_KEY
-
JOINS
-
JOIN
-
INHERITANCE
-
DISCRIMINATOR
-
QUERIES
-
QUERY
-
FETCHPLAN
-
FETCHPLANS
-
FETCHGROUPS
-
FETCHGROUP
-
SEQUENCE
-
INDICES
-
INDEX
-
UNIQUES
-
UNIQUE
-
FOREIGNKEYS
-
FOREIGNKEY
-
COLUMNS
-
COLUMN
-
EXTENSIONS
-
EXTENSION
-
PERSISTENT
-
TRANSACTIONAL
-
NOTPERSISTENT
-
SERIALIZED
-
ELEMENT
-
KEY
-
VALUE
-
ORDER
-
EMBEDDED
-
CACHEABLE
-
CONVERT
-
PRESTORE
- See Also:
-
PREDELETE
- See Also:
-
PREATTACH
- See Also:
-
POSTATTACH
- See Also:
-
PRECLEAR
- See Also:
-
PREDETACH
- See Also:
-
POSTDETACH
- See Also:
-
POSTLOAD
- See Also:
-
-
Constructor Details
-
JDOAnnotationUtils
public JDOAnnotationUtils()
-
-
Method Details
-
getQueryLanguageName
Convenience accessor for the query language to a valid internal value.- Parameters:
value
- The query language name- Returns:
- The internal name
-
getNullValueString
Convenience accessor for the string name of a null value action.- Parameters:
value
- The annotation null value- Returns:
- The name
-
getForeignKeyActionString
Convenience accessor for the string name of a FK action.- Parameters:
action
- The annotation action- Returns:
- The name
-
getFieldPersistenceModifier
public static org.datanucleus.metadata.FieldPersistenceModifier getFieldPersistenceModifier(javax.jdo.annotations.PersistenceModifier modifier) Convenience accessor for the persistence-modifier on a field.- Parameters:
modifier
- The annotation modifier- Returns:
- The modifier
-
getIdentityTypeString
Convenience accessor for the string name of the identity type.- Parameters:
idType
- The id type- Returns:
- The name
-
getSequenceStrategyString
Convenience accessor for the string name of a datastore sequence strategy.- Parameters:
strategy
- The annotation strategy- Returns:
- The name
-
getValueGenerationStrategyString
public static String getValueGenerationStrategyString(javax.jdo.annotations.IdGeneratorStrategy strategy) Convenience accessor for the string name of a id generator strategy (from JDO annotations).- Parameters:
strategy
- The id generation strategy- Returns:
- The name
-
getVersionStrategyString
Convenience accessor for the string name of a version strategy.- Parameters:
strategy
- The version strategy- Returns:
- The name
-
getInheritanceStrategyString
public static String getInheritanceStrategyString(javax.jdo.annotations.InheritanceStrategy strategy) Convenience accessor for the string name of an inheritance strategy.- Parameters:
strategy
- The inheritance strategy- Returns:
- The name
-
getDiscriminatorStrategyString
public static String getDiscriminatorStrategyString(javax.jdo.annotations.DiscriminatorStrategy strategy) Convenience accessor for the string name of a discriminator strategy.- Parameters:
strategy
- The discriminator strategy- Returns:
- The name
-
getColumnMetaDataForAnnotations
public static org.datanucleus.metadata.ColumnMetaData getColumnMetaDataForAnnotations(Map<String, Object> annotationValues) Convenience method to get the column metadata for annotation values of a @Column.- Parameters:
annotationValues
- The values for the annotation- Returns:
- The MetaData for the column
-
getColumnMetaDataForColumnAnnotation
public static org.datanucleus.metadata.ColumnMetaData getColumnMetaDataForColumnAnnotation(javax.jdo.annotations.Column col) Convenience method to get the column metadata for a Column annotation.- Parameters:
col
- The Column annotation- Returns:
- The MetaData for the column
-
getIndexMetaData
public static org.datanucleus.metadata.IndexMetaData getIndexMetaData(String name, String table, String unique, String[] fields, javax.jdo.annotations.Column[] columns) Convenience method to create an IndexMetaData from the annotations data.- Parameters:
name
- Name of the constrainttable
- Name of the table (optional)unique
- Whether the constraint is uniquefields
- Fields to apply the constraint across (optional)columns
- Columns to apply the constraint across (optional)- Returns:
- The IndexMetaData
-
getUniqueMetaData
public static org.datanucleus.metadata.UniqueMetaData getUniqueMetaData(String name, String table, String deferred, String[] fields, javax.jdo.annotations.Column[] columns) Convenience method to create a UniqueMetaData from the annotations data.- Parameters:
name
- Name of the constrainttable
- Name of the table (optional)deferred
- Whether the constraint is deferredfields
- Fields to apply the constraint across (optional)columns
- Columns to apply the constraint across (optional)- Returns:
- The UniqueMetaData
-
getFKMetaData
public static org.datanucleus.metadata.ForeignKeyMetaData getFKMetaData(String name, String table, String unique, String deferred, String deleteAction, String updateAction, String[] fields, javax.jdo.annotations.Column[] columns) Convenience method to create a ForeignKeyMetaData from the annotations data.- Parameters:
name
- Name of the constrainttable
- Name of the table (optional)unique
- Whether the constraint is uniquedeferred
- Whether the constraint is deferreddeleteAction
- Any delete actionupdateAction
- Any update actionfields
- Fields to apply the constraint across (optional)columns
- Columns to apply the constraint across (optional)- Returns:
- The ForeignKeyMetaData
-
addExtensionsToMetaData
public static void addExtensionsToMetaData(org.datanucleus.metadata.MetaData metadata, javax.jdo.annotations.Extension[] extensions) Convenience method to add extensions to a metadata element.- Parameters:
metadata
- The metadata elementextensions
- The extension annotations
-