com.sun.jdo.api.persistence.enhancer.meta
Class JDOMetaDataPropertyImpl

java.lang.Object
  extended by com.sun.jdo.api.persistence.enhancer.util.Assertion
      extended by com.sun.jdo.api.persistence.enhancer.util.Support
          extended by com.sun.jdo.api.persistence.enhancer.meta.JDOMetaDataPropertyImpl
All Implemented Interfaces:
ExtendedJDOMetaData, JDOMetaData

public class JDOMetaDataPropertyImpl
extends Support
implements ExtendedJDOMetaData

Provides the JDO meta information based on properties.


Field Summary
 
Fields inherited from class com.sun.jdo.api.persistence.enhancer.util.Support
timer
 
Fields inherited from interface com.sun.jdo.api.persistence.enhancer.meta.ExtendedJDOMetaData
CHECK_READ, CHECK_WRITE, MEDIATE_READ, MEDIATE_WRITE, SERIALIZABLE
 
Fields inherited from interface com.sun.jdo.api.persistence.enhancer.meta.JDOMetaData
javaLangCloneablePath, JDOExternalPath, JDOFlagsFieldName, JDOFlagsFieldSig, JDOFlagsFieldType, JDOInstanceCallbacksName, JDOInstanceCallbacksPath, JDOInstanceCallbacksSig, JDOInstanceCallbacksType, JDOPath, JDOPersistenceCapableName, JDOPersistenceCapablePath, JDOPersistenceCapableSig, JDOPersistenceCapableType, JDOPersistenceManagerName, JDOPersistenceManagerPath, JDOPersistenceManagerSig, JDOPersistenceManagerType, JDOSecondClassObjectBaseName, JDOSecondClassObjectBasePath, JDOSecondClassObjectBaseSig, JDOSecondClassObjectBaseType, JDOStateManagerFieldName, JDOStateManagerFieldSig, JDOStateManagerFieldType, JDOStateManagerName, JDOStateManagerPath, JDOStateManagerSig, JDOStateManagerType
 
Constructor Summary
JDOMetaDataPropertyImpl(Properties properties)
          Creates an instance.
JDOMetaDataPropertyImpl(Properties properties, PrintWriter out)
          Creates an instance.
 
Method Summary
 int getClassModifiers(String classname)
          Gets the access modifier of a class.
 int getFieldFlags(String classPath, String fieldName)
          Returns the field flags for a declared field of a class.
 int[] getFieldFlags(String classPath, String[] fieldNames)
          Returns the field flags for some declared, managed fields of a class.
 int getFieldModifiers(String classname, String fieldname)
          Gets the access modifier of a field.
 int getFieldNo(String classPath, String fieldName)
          Returns the unique field index of a declared, persistent field of a class.
 int[] getFieldNo(String classPath, String[] fieldNames)
          Returns the unique field index of some declared, managed fields of a class.
 String getFieldType(String classname, String fieldname)
          Gets the type of a field.
 String[] getFieldType(String classname, String[] fieldnames)
          Gets the type of some fields.
 String getKeyClass(String classPath)
          Returns the name of the key class of a class.
 String[] getKeyFields(String classPath)
          Returns an array of field names of all key fields of a class.
 String[] getKnownClasses()
          No interface method.
 String[] getKnownFields(String classname)
          Gets all known fields of a class.
 String[] getManagedFields(String classname)
          Returns an array of field names of all declared, persistent fields of a class.
 String getPersistenceCapableRootClass(String classPath)
          Returns the name of the persistence-capable root class of a class.
 String getPersistenceCapableSuperClass(String classPath)
          Returns the name of the persistence-capable superclass of a class.
 String getSuperClass(String classname)
          Returns the superclass of a class.
 String getSuperKeyClass(String classPath)
          Returns the name of the key class of the next persistence-capable superclass that defines one.
 boolean isDefaultFetchGroupField(String classPath, String fieldName)
          Tests whether a field of a class is known to be part of the Default Fetch Group.
 boolean isKeyField(String classPath, String fieldName)
          Returns whether a field of a class is key.
 boolean isKnownNonManagedField(String classPath, String fieldName, String fieldSig)
          Returns whether a field of a class is known to be non-managed.
 boolean isManagedField(String classPath, String fieldName)
          Returns whether a field of a class is transient transactional or persistent.
 boolean isMutableSecondClassObjectType(String classPath)
          Tests whether a type is known for Mutable Second Class Objects.
 boolean isPersistenceCapableClass(String classPath)
          Tests whether a class is known to be persistence-capable.
 boolean isPersistenceCapableRootClass(String classPath)
          Tests whether a class is known as a persistence-capable root class.
 boolean isPersistentField(String classPath, String fieldName)
          Tests whether a field of a class is known to be persistent.
 boolean isPrimaryKeyField(String classPath, String fieldName)
          Tests whether a field of a class is known to be Primary Key.
 boolean isSecondClassObjectType(String classPath)
          Tests whether a type is known for Second Class Objects.
 boolean isTransactionalField(String classPath, String fieldName)
          Tests whether a field of a class is known to be transactional.
 boolean isTransientClass(String classPath)
          Tests whether a class is known to be transient.
 
Methods inherited from class com.sun.jdo.api.persistence.enhancer.util.Support
getI18N, getI18N, getI18N, getI18N, getI18N, getI18N
 
Methods inherited from class com.sun.jdo.api.persistence.enhancer.util.Assertion
affirm, affirm, affirm, affirm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDOMetaDataPropertyImpl

public JDOMetaDataPropertyImpl(Properties properties,
                               PrintWriter out)
                        throws JDOMetaDataUserException,
                               JDOMetaDataFatalError
Creates an instance. //@lars: out id not used anymore

Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

JDOMetaDataPropertyImpl

public JDOMetaDataPropertyImpl(Properties properties)
                        throws JDOMetaDataUserException,
                               JDOMetaDataFatalError
Creates an instance. //@lars: out id not used anymore

Throws:
JDOMetaDataUserException
JDOMetaDataFatalError
Method Detail

isPersistenceCapableClass

public boolean isPersistenceCapableClass(String classPath)
                                  throws JDOMetaDataUserException,
                                         JDOMetaDataFatalError
Tests whether a class is known to be persistence-capable.

Specified by:
isPersistenceCapableClass in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
Returns:
true if this class is persistence-capable; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

isTransientClass

public boolean isTransientClass(String classPath)
                         throws JDOMetaDataUserException,
                                JDOMetaDataFatalError
Description copied from interface: JDOMetaData
Tests whether a class is known to be transient.

The following invariant holds: isTransientClass(classPath) => !isPersistenceCapableClass(classPath)

Specified by:
isTransientClass in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
Returns:
true if this class is known to be transient; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

isPersistenceCapableRootClass

public boolean isPersistenceCapableRootClass(String classPath)
                                      throws JDOMetaDataUserException,
                                             JDOMetaDataFatalError
Tests whether a class is known as a persistence-capable root class.

Specified by:
isPersistenceCapableRootClass in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
Returns:
true if this class is persistence-capable and does not derive from another persistence-capable class; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getPersistenceCapableRootClass

public String getPersistenceCapableRootClass(String classPath)
                                      throws JDOMetaDataUserException,
                                             JDOMetaDataFatalError
Returns the name of the persistence-capable root class of a class.

Specified by:
getPersistenceCapableRootClass in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
Returns:
the name of the least-derived persistence-capable class that is equal to or a super class of the argument class; if the argument class is not persistence-capable, null is returned.
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getSuperClass

public final String getSuperClass(String classname)
Returns the superclass of a class.

Specified by:
getSuperClass in interface JDOMetaData
Parameters:
classname - the JVM-qualified name of the class
Returns:
the name of the superclass.

isSecondClassObjectType

public boolean isSecondClassObjectType(String classPath)
                                throws JDOMetaDataUserException,
                                       JDOMetaDataFatalError
Tests whether a type is known for Second Class Objects.

Specified by:
isSecondClassObjectType in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the type
Returns:
true if this type is known for second class objects; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

isMutableSecondClassObjectType

public boolean isMutableSecondClassObjectType(String classPath)
                                       throws JDOMetaDataUserException,
                                              JDOMetaDataFatalError
Tests whether a type is known for Mutable Second Class Objects.

Specified by:
isMutableSecondClassObjectType in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the type
Returns:
true if this type is known for mutable second class objects; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

isPersistentField

public boolean isPersistentField(String classPath,
                                 String fieldName)
                          throws JDOMetaDataUserException,
                                 JDOMetaDataFatalError
Tests whether a field of a class is known to be persistent.

Specified by:
isPersistentField in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
fieldName - the name of the field
Returns:
true if this field is known to be persistent; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

isTransactionalField

public boolean isTransactionalField(String classPath,
                                    String fieldName)
                             throws JDOMetaDataUserException,
                                    JDOMetaDataFatalError
Tests whether a field of a class is known to be transactional.

Specified by:
isTransactionalField in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
fieldName - the name of the field
Returns:
true if this field is known to be transactional; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

isPrimaryKeyField

public boolean isPrimaryKeyField(String classPath,
                                 String fieldName)
                          throws JDOMetaDataUserException,
                                 JDOMetaDataFatalError
Tests whether a field of a class is known to be Primary Key.

Specified by:
isPrimaryKeyField in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
fieldName - the name of the field
Returns:
true if this field is known to be primary key; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

isDefaultFetchGroupField

public boolean isDefaultFetchGroupField(String classPath,
                                        String fieldName)
                                 throws JDOMetaDataUserException,
                                        JDOMetaDataFatalError
Tests whether a field of a class is known to be part of the Default Fetch Group.

Specified by:
isDefaultFetchGroupField in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
fieldName - the name of the field
Returns:
true if this field is known to be part of the default fetch group; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getFieldNo

public int getFieldNo(String classPath,
                      String fieldName)
               throws JDOMetaDataUserException,
                      JDOMetaDataFatalError
Returns the unique field index of a declared, persistent field of a class.

Specified by:
getFieldNo in interface JDOMetaData
Parameters:
classPath - the JVM-qualified name of the class
fieldName - the name of the field
Returns:
the non-negative, unique field index
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getManagedFields

public String[] getManagedFields(String classname)
Returns an array of field names of all declared, persistent fields of a class.

Specified by:
getManagedFields in interface JDOMetaData
Parameters:
classname - the JVM-qualified name of the class
Returns:
an array of all declared persistent and transactional fields of a class

getKnownClasses

public final String[] getKnownClasses()
No interface method.

Specified by:
getKnownClasses in interface ExtendedJDOMetaData
Returns:
All known classnames.

getKnownFields

public final String[] getKnownFields(String classname)
Gets all known fields of a class.

Specified by:
getKnownFields in interface ExtendedJDOMetaData
Parameters:
classname - The classname.
Returns:
All known fieldnames.

getClassModifiers

public final int getClassModifiers(String classname)
Gets the access modifier of a class.

Specified by:
getClassModifiers in interface ExtendedJDOMetaData
Parameters:
classname - The classname.
Returns:
The modifiers.
See Also:
Modifier

getFieldModifiers

public final int getFieldModifiers(String classname,
                                   String fieldname)
Gets the access modifier of a field.

Specified by:
getFieldModifiers in interface ExtendedJDOMetaData
Parameters:
classname - The classname.
fieldname - The fieldname.
Returns:
The modifiers.
See Also:
Modifier

getFieldType

public final String getFieldType(String classname,
                                 String fieldname)
Description copied from interface: ExtendedJDOMetaData
Gets the type of a field.

Specified by:
getFieldType in interface ExtendedJDOMetaData
Parameters:
classname - The classname.
fieldname - The fieldname.
Returns:
The type of the field.

getKeyClass

public String getKeyClass(String classPath)
                   throws JDOMetaDataUserException,
                          JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns the name of the key class of a class.

The following holds: (String s = getKeyClass(classPath)) != null ==> !isPersistenceCapableClass(s) && isPersistenceCapableClass(classPath)

Specified by:
getKeyClass in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
Returns:
the name of the key class or null if there is none
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError
See Also:
JDOMetaData.isPersistenceCapableClass(String)

isKeyField

public boolean isKeyField(String classPath,
                          String fieldName)
                   throws JDOMetaDataUserException,
                          JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns whether a field of a class is key.

A key field must be persistent. The following holds: isKeyField(classPath, fieldName) ==> isPersistentField(classPath, fieldName) && !isDefaultFetchGroupField(classPath, fieldName)

This method requires the field having been declared by declareField().

Specified by:
isKeyField in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldName - the non-null name of the field
Returns:
true if this field is key; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError
See Also:
JDOMetaData.isPersistentField(String, String)

isKnownNonManagedField

public boolean isKnownNonManagedField(String classPath,
                                      String fieldName,
                                      String fieldSig)
Description copied from interface: ExtendedJDOMetaData
Returns whether a field of a class is known to be non-managed.

This method differs from isManagedField() in that a field may or may not be managed if its not known as non-managed. The following holds (not vice versa!): isKnownNonManagedField(classPath, fieldName) ==> !isManagedField(classPath, fieldName)

This method doesn't require the field having been declared by declareField().

Specified by:
isKnownNonManagedField in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldName - the non-null name of the field
fieldSig - the non-null type signature of the field
Returns:
true if this field is known to be non-managed; otherwise false
See Also:
ExtendedJDOMetaData.isManagedField(String, String)

isManagedField

public boolean isManagedField(String classPath,
                              String fieldName)
                       throws JDOMetaDataUserException,
                              JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns whether a field of a class is transient transactional or persistent.

A managed field must not be known as non-managed and must be either transient transactional or persistent. The following holds: isManagedField(classPath, fieldName) ==> !isKnownNonManagedField(classPath, fieldName) && (isPersistentField(classPath, fieldName) ^ isTransactionalField(classPath, fieldName))

This method requires the field having been declared by declareField().

Specified by:
isManagedField in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldName - the non-null name of the field
Returns:
true if this field is managed; otherwise false
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError
See Also:
ExtendedJDOMetaData.isKnownNonManagedField(String, String, String), JDOMetaData.isPersistentField(String, String), JDOMetaData.isPersistenceCapableClass(String)

getFieldFlags

public int getFieldFlags(String classPath,
                         String fieldName)
                  throws JDOMetaDataUserException,
                         JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns the field flags for a declared field of a class.

The following holds for the field flags: int f = getFieldFlags(classPath, fieldName); !isManagedField(classPath, fieldName) ==> (f & CHECK_READ == 0) && (f & MEDIATE_READ == 0) && (f & CHECK_WRITE == 0) && (f & MEDIATE_WRITE == 0) isTransientField(classPath, fieldName) ==> (f & CHECK_READ == 0) && (f & MEDIATE_READ == 0) && (f & CHECK_WRITE != 0) && (f & MEDIATE_WRITE == 0) isKeyField(classPath, fieldName) ==> (f & CHECK_READ == 0) && (f & MEDIATE_READ == 0) && (f & CHECK_WRITE == 0) && (f & MEDIATE_WRITE != 0) isDefaultFetchGroupField(classPath, fieldName) ==> (f & CHECK_READ != 0) && (f & MEDIATE_READ != 0) && (f & CHECK_WRITE == 0) && (f & MEDIATE_WRITE == 0) isPersistentField(classPath, fieldName) && isKeyField(classPath, fieldName) && isDefaultFetchGroupField(classPath, fieldName) ==> (f & CHECK_READ == 0) && (f & MEDIATE_READ == 0) && (f & CHECK_WRITE != 0) && (f & MEDIATE_WRITE != 0)

This method requires the field having been declared by declareField().

Specified by:
getFieldFlags in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldName - the non-null name of the field
Returns:
the field flags for this field
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getFieldFlags

public int[] getFieldFlags(String classPath,
                           String[] fieldNames)
                    throws JDOMetaDataUserException,
                           JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns the field flags for some declared, managed fields of a class.

This method requires all fields having been declared by declareField().

Specified by:
getFieldFlags in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldNames - the non-null array of names of the declared fields
Returns:
the field flags for the fields
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getFieldType

public final String[] getFieldType(String classname,
                                   String[] fieldnames)
Description copied from interface: ExtendedJDOMetaData
Gets the type of some fields.

Specified by:
getFieldType in interface ExtendedJDOMetaData
Parameters:
classname - The classname.
fieldnames - The fieldnames.
Returns:
The type of the fields.

getFieldNo

public int[] getFieldNo(String classPath,
                        String[] fieldNames)
                 throws JDOMetaDataUserException,
                        JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns the unique field index of some declared, managed fields of a class.

This method requires all fields having been declared by declareField().

Specified by:
getFieldNo in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldNames - the non-null array of names of the declared fields
Returns:
the non-negative, unique field indices
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getKeyFields

public String[] getKeyFields(String classPath)
                      throws JDOMetaDataUserException,
                             JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns an array of field names of all key fields of a class.

This method requires all fields having been declared by declareField().

Specified by:
getKeyFields in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
Returns:
an array of all declared key fields of a class
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError

getPersistenceCapableSuperClass

public String getPersistenceCapableSuperClass(String classPath)
                                       throws JDOMetaDataUserException,
                                              JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns the name of the persistence-capable superclass of a class.

The following holds: (String s = getPersistenceCapableSuperClass(classPath)) != null ==> isPersistenceCapableClass(classPath) && !isPersistenceCapableRootClass(classPath)

Specified by:
getPersistenceCapableSuperClass in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
Returns:
the name of the PC superclass or null if there is none
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError
See Also:
JDOMetaData.isPersistenceCapableClass(String), JDOMetaData.getPersistenceCapableRootClass(String)

getSuperKeyClass

public String getSuperKeyClass(String classPath)
                        throws JDOMetaDataUserException,
                               JDOMetaDataFatalError
Description copied from interface: ExtendedJDOMetaData
Returns the name of the key class of the next persistence-capable superclass that defines one.

The following holds: (String s = getSuperKeyClass(classPath)) != null ==> !isPersistenceCapableClass(s) && isPersistenceCapableClass(classPath) && !isPersistenceCapableRootClass(classPath)

Specified by:
getSuperKeyClass in interface ExtendedJDOMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
Returns:
the name of the key class or null if there is none
Throws:
JDOMetaDataUserException
JDOMetaDataFatalError
See Also:
ExtendedJDOMetaData.getKeyClass(String), ExtendedJDOMetaData.getPersistenceCapableSuperClass(String)


Copyright © 2012. All Rights Reserved.