org.datanucleus.jdo.metadata
Class JDOAnnotationUtils

java.lang.Object
  extended by org.datanucleus.jdo.metadata.JDOAnnotationUtils

public class JDOAnnotationUtils
extends java.lang.Object

Series of utility methods for converting between annotations and metadata.


Field Summary
static java.lang.String CACHEABLE
           
static java.lang.String COLUMN
           
static java.lang.String COLUMNS
           
static java.lang.String DATASTORE_IDENTITY
           
static java.lang.String DISCRIMINATOR
           
static java.lang.String ELEMENT
           
static java.lang.String EMBEDDED
           
static java.lang.String EMBEDDED_ONLY
           
static java.lang.String EXTENSION
           
static java.lang.String EXTENSIONS
           
static java.lang.String FETCHGROUP
           
static java.lang.String FETCHGROUPS
           
static java.lang.String FETCHPLAN
           
static java.lang.String FETCHPLANS
           
static java.lang.String FOREIGNKEY
           
static java.lang.String FOREIGNKEYS
           
static java.lang.String INDEX
           
static java.lang.String INDICES
           
static java.lang.String INHERITANCE
           
static java.lang.String JOIN
           
static java.lang.String JOINS
           
static java.lang.String KEY
           
static java.lang.String NOTPERSISTENT
           
static java.lang.String ORDER
           
static java.lang.String PERSISTENCE_AWARE
           
static java.lang.String PERSISTENCE_CAPABLE
           
static java.lang.String PERSISTENT
           
static java.lang.String PRIMARY_KEY
           
static java.lang.String QUERIES
           
static java.lang.String QUERY
           
static java.lang.String SEQUENCE
           
static java.lang.String SERIALIZED
           
static java.lang.String TRANSACTIONAL
           
static java.lang.String UNIQUE
           
static java.lang.String UNIQUES
           
static java.lang.String VALUE
           
static java.lang.String VERSION
           
 
Constructor Summary
JDOAnnotationUtils()
           
 
Method Summary
static void addExtensionsToMetaData(MetaData metadata, javax.jdo.annotations.Extension[] extensions)
          Convenience method to add extensions to a metadata element.
static ColumnMetaData getColumnMetaDataForAnnotations(java.util.HashMap<java.lang.String,java.lang.Object> annotationValues)
          Convenience method to get the column metadata for annotation values of a @Column.
static ColumnMetaData getColumnMetaDataForColumnAnnotation(javax.jdo.annotations.Column col)
          Convenience method to get the column metadata for a Column annotation.
static java.lang.String getDiscriminatorStrategyString(javax.jdo.annotations.DiscriminatorStrategy strategy)
          Convenience accessor for the string name of a discriminator strategy.
static java.lang.String getFieldPersistenceModifierString(javax.jdo.annotations.PersistenceModifier modifier)
          Convenience accessor for the string name of a persistence-modifier on a field.
static ForeignKeyMetaData getFKMetaData(java.lang.String name, java.lang.String table, java.lang.String unique, java.lang.String deferred, java.lang.String deleteAction, java.lang.String updateAction, java.lang.String[] fields, javax.jdo.annotations.Column[] columns)
          Convenience method to create a ForeignKeyMetaData from the annotations data.
static java.lang.String getForeignKeyActionString(javax.jdo.annotations.ForeignKeyAction action)
          Convenience accessor for the string name of a FK action.
static java.lang.String getIdentityStrategyString(javax.jdo.annotations.IdGeneratorStrategy strategy)
          Convenience accessor for the string name of a id generator strategy (from JDO annotations).
static java.lang.String getIdentityTypeString(javax.jdo.annotations.IdentityType idType)
          Convenience accessor for the string name of the identity type.
static IndexMetaData getIndexMetaData(java.lang.String name, java.lang.String table, java.lang.String unique, java.lang.String[] fields, javax.jdo.annotations.Column[] columns)
          Convenience method to create an IndexMetaData from the annotations data.
static java.lang.String getInheritanceStrategyString(javax.jdo.annotations.InheritanceStrategy strategy)
          Convenience accessor for the string name of an inheritance strategy.
static java.lang.String getNullValueString(javax.jdo.annotations.NullValue value)
          Convenience accessor for the string name of a null value action.
static java.lang.String getQueryLanguageName(java.lang.String value)
          Convenience accessor for the query language to a valid internal value.
static java.lang.String getSequenceStrategyString(javax.jdo.annotations.SequenceStrategy strategy)
          Convenience accessor for the string name of a datastore sequence strategy.
static UniqueMetaData getUniqueMetaData(java.lang.String name, java.lang.String table, java.lang.String deferred, java.lang.String[] fields, javax.jdo.annotations.Column[] columns)
          Convenience method to create a UniqueMetaData from the annotations data.
static java.lang.String getVersionStrategyString(javax.jdo.annotations.VersionStrategy strategy)
          Convenience accessor for the string name of a version strategy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERSISTENCE_CAPABLE

public static final java.lang.String PERSISTENCE_CAPABLE

PERSISTENCE_AWARE

public static final java.lang.String PERSISTENCE_AWARE

EMBEDDED_ONLY

public static final java.lang.String EMBEDDED_ONLY

VERSION

public static final java.lang.String VERSION

DATASTORE_IDENTITY

public static final java.lang.String DATASTORE_IDENTITY

PRIMARY_KEY

public static final java.lang.String PRIMARY_KEY

JOINS

public static final java.lang.String JOINS

JOIN

public static final java.lang.String JOIN

INHERITANCE

public static final java.lang.String INHERITANCE

DISCRIMINATOR

public static final java.lang.String DISCRIMINATOR

QUERIES

public static final java.lang.String QUERIES

QUERY

public static final java.lang.String QUERY

FETCHPLAN

public static final java.lang.String FETCHPLAN

FETCHPLANS

public static final java.lang.String FETCHPLANS

FETCHGROUPS

public static final java.lang.String FETCHGROUPS

FETCHGROUP

public static final java.lang.String FETCHGROUP

SEQUENCE

public static final java.lang.String SEQUENCE

INDICES

public static final java.lang.String INDICES

INDEX

public static final java.lang.String INDEX

UNIQUES

public static final java.lang.String UNIQUES

UNIQUE

public static final java.lang.String UNIQUE

FOREIGNKEYS

public static final java.lang.String FOREIGNKEYS

FOREIGNKEY

public static final java.lang.String FOREIGNKEY

COLUMNS

public static final java.lang.String COLUMNS

COLUMN

public static final java.lang.String COLUMN

EXTENSIONS

public static final java.lang.String EXTENSIONS

EXTENSION

public static final java.lang.String EXTENSION

PERSISTENT

public static final java.lang.String PERSISTENT

TRANSACTIONAL

public static final java.lang.String TRANSACTIONAL

NOTPERSISTENT

public static final java.lang.String NOTPERSISTENT

SERIALIZED

public static final java.lang.String SERIALIZED

ELEMENT

public static final java.lang.String ELEMENT

KEY

public static final java.lang.String KEY

VALUE

public static final java.lang.String VALUE

ORDER

public static final java.lang.String ORDER

EMBEDDED

public static final java.lang.String EMBEDDED

CACHEABLE

public static final java.lang.String CACHEABLE
See Also:
Constant Field Values
Constructor Detail

JDOAnnotationUtils

public JDOAnnotationUtils()
Method Detail

getQueryLanguageName

public static java.lang.String getQueryLanguageName(java.lang.String value)
Convenience accessor for the query language to a valid internal value.

Parameters:
value - The query language name
Returns:
The internal name

getNullValueString

public static java.lang.String getNullValueString(javax.jdo.annotations.NullValue value)
Convenience accessor for the string name of a null value action.

Parameters:
value - The annotation null value
Returns:
The name

getForeignKeyActionString

public static java.lang.String getForeignKeyActionString(javax.jdo.annotations.ForeignKeyAction action)
Convenience accessor for the string name of a FK action.

Parameters:
action - The annotation action
Returns:
The name

getFieldPersistenceModifierString

public static java.lang.String getFieldPersistenceModifierString(javax.jdo.annotations.PersistenceModifier modifier)
Convenience accessor for the string name of a persistence-modifier on a field.

Parameters:
modifier - The annotation modifier
Returns:
The name

getIdentityTypeString

public static java.lang.String getIdentityTypeString(javax.jdo.annotations.IdentityType idType)
Convenience accessor for the string name of the identity type.

Parameters:
idType - The id type
Returns:
The name

getSequenceStrategyString

public static java.lang.String getSequenceStrategyString(javax.jdo.annotations.SequenceStrategy strategy)
Convenience accessor for the string name of a datastore sequence strategy.

Parameters:
strategy - The annotation strategy
Returns:
The name

getIdentityStrategyString

public static java.lang.String getIdentityStrategyString(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

public static java.lang.String getVersionStrategyString(javax.jdo.annotations.VersionStrategy strategy)
Convenience accessor for the string name of a version strategy.

Parameters:
strategy - The version strategy
Returns:
The name

getInheritanceStrategyString

public static java.lang.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 java.lang.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 ColumnMetaData getColumnMetaDataForAnnotations(java.util.HashMap<java.lang.String,java.lang.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 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 IndexMetaData getIndexMetaData(java.lang.String name,
                                             java.lang.String table,
                                             java.lang.String unique,
                                             java.lang.String[] fields,
                                             javax.jdo.annotations.Column[] columns)
Convenience method to create an IndexMetaData from the annotations data.

Parameters:
name - Name of the constraint
table - Name of the table (optional)
unique - Whether the constraint is unique
fields - Fields to apply the constraint across (optional)
columns - Columns to apply the constraint across (optional)
Returns:
The IndexMetaData

getUniqueMetaData

public static UniqueMetaData getUniqueMetaData(java.lang.String name,
                                               java.lang.String table,
                                               java.lang.String deferred,
                                               java.lang.String[] fields,
                                               javax.jdo.annotations.Column[] columns)
Convenience method to create a UniqueMetaData from the annotations data.

Parameters:
name - Name of the constraint
table - Name of the table (optional)
deferred - Whether the constraint is deferred
fields - Fields to apply the constraint across (optional)
columns - Columns to apply the constraint across (optional)
Returns:
The UniqueMetaData

getFKMetaData

public static ForeignKeyMetaData getFKMetaData(java.lang.String name,
                                               java.lang.String table,
                                               java.lang.String unique,
                                               java.lang.String deferred,
                                               java.lang.String deleteAction,
                                               java.lang.String updateAction,
                                               java.lang.String[] fields,
                                               javax.jdo.annotations.Column[] columns)
Convenience method to create a ForeignKeyMetaData from the annotations data.

Parameters:
name - Name of the constraint
table - Name of the table (optional)
unique - Whether the constraint is unique
deferred - Whether the constraint is deferred
fields - Fields to apply the constraint across (optional)
columns - Columns to apply the constraint across (optional)
Returns:
The ForeignKeyMetaData

addExtensionsToMetaData

public static void addExtensionsToMetaData(MetaData metadata,
                                           javax.jdo.annotations.Extension[] extensions)
Convenience method to add extensions to a metadata element.

Parameters:
metadata - The metadata element
extensions - The extension annotations


Copyright © 2011. All Rights Reserved.