org.apache.jdo.impl.enhancer.meta.prop
Class EnhancerMetaDataPropertyImpl

java.lang.Object
  extended by org.apache.jdo.impl.enhancer.util.Assertion
      extended by org.apache.jdo.impl.enhancer.util.Support
          extended by org.apache.jdo.impl.enhancer.meta.util.EnhancerMetaDataBaseModel
              extended by org.apache.jdo.impl.enhancer.meta.prop.EnhancerMetaDataPropertyImpl
All Implemented Interfaces:
EnhancerMetaData, ExtendedMetaData

public class EnhancerMetaDataPropertyImpl
extends EnhancerMetaDataBaseModel
implements ExtendedMetaData

Provides the JDO meta information based on properties.


Field Summary
 
Fields inherited from class org.apache.jdo.impl.enhancer.meta.util.EnhancerMetaDataBaseModel
out, unenhancableTypePrefixes, verbose
 
Fields inherited from class org.apache.jdo.impl.enhancer.util.Support
timer
 
Fields inherited from interface org.apache.jdo.impl.enhancer.meta.EnhancerMetaData
CHECK_READ, CHECK_WRITE, MEDIATE_READ, MEDIATE_WRITE, SERIALIZABLE
 
Constructor Summary
EnhancerMetaDataPropertyImpl(java.io.PrintWriter out, boolean verbose, java.util.Properties properties)
          Creates an instance.
EnhancerMetaDataPropertyImpl(java.io.PrintWriter out, boolean verbose, java.lang.String fileName)
          Creates an instance.
 
Method Summary
 void declareField(java.lang.String classPath, java.lang.String fieldName, java.lang.String signature)
          Declares a field to the JDO model passing its type information.
 int getClassModifiers(java.lang.String classname)
          Gets the access modifier of a class.
 java.lang.String getDeclaringClass(java.lang.String classPath, java.lang.String fieldName)
          Returns the JVM-qualified name of the specified field's declaring class.
 int getFieldModifiers(java.lang.String classname, java.lang.String fieldname)
          Gets the access modifier of a field.
 int[] getFieldModifiers(java.lang.String classname, java.lang.String[] fieldnames)
          Gets the modifiers of some fields.
 int getFieldNumber(java.lang.String classPath, java.lang.String fieldName)
          Returns the unique field index of a declared, persistent field of a class.
 java.lang.String getFieldType(java.lang.String classname, java.lang.String fieldname)
          Gets the type of a field.
 java.lang.String[] getFieldType(java.lang.String classname, java.lang.String[] fieldnames)
          Gets the type of some fields.
 java.lang.String getKeyClass(java.lang.String classPath)
          Returns the name of the key class of a persistence-capable class.
 java.lang.String[] getKnownClasses()
          Not member of EnhancerMetaData Interface.
 java.lang.String[] getKnownFields(java.lang.String classname)
          Gets all known fields of a class.
 java.lang.String[] getManagedFields(java.lang.String classname)
          Returns an array of field names of all declared, persistent fields of a class.
 java.lang.String getPersistenceCapableSuperClass(java.lang.String classPath)
          Returns the name of the persistence-capable superclass of a class.
 java.lang.String getSuperClass(java.lang.String classname)
          Returns the superclass of a class.
 boolean isDefaultFetchGroupField(java.lang.String classPath, java.lang.String fieldName)
          Returns whether a field of a class is known to be part of the Default Fetch Group.
 boolean isKeyField(java.lang.String classPath, java.lang.String fieldName)
          Returns whether a field of a class is known to be Primary Key.
 boolean isKnownNonManagedField(java.lang.String classPath, java.lang.String fieldName, java.lang.String fieldSig)
          Returns whether a field of a class is known to be non-managed.
 boolean isManagedField(java.lang.String classPath, java.lang.String fieldName)
          Returns whether a field of a class is transient transactional or persistent.
 boolean isPersistenceCapableClass(java.lang.String classPath)
          Returns whether a class is known to be persistence-capable.
 boolean isPersistentField(java.lang.String classPath, java.lang.String fieldName)
          Returns whether a field of a class is known to be persistent.
 boolean isSerializableClass(java.lang.String classPath)
          Returns whether a class implements java.io.Serializable.
 boolean isTransactionalField(java.lang.String classPath, java.lang.String fieldName)
          Returns whether a field of a class is known to be transactional.
static void main(java.lang.String[] argv)
           
 
Methods inherited from class org.apache.jdo.impl.enhancer.meta.util.EnhancerMetaDataBaseModel
getFieldFlags, getFieldFlags, getFieldNumber, getKeyFields, getPersistenceCapableRootClass, getSuperKeyClass, isKnownUnenhancableClass, isPersistenceCapableRootClass, printMessage, printWarning
 
Methods inherited from class org.apache.jdo.impl.enhancer.util.Support
getI18N, getI18N, getI18N, getI18N, getI18N, getI18N
 
Methods inherited from class org.apache.jdo.impl.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
 
Methods inherited from interface org.apache.jdo.impl.enhancer.meta.EnhancerMetaData
getFieldFlags, getFieldFlags, getFieldNumber, getKeyFields, getPersistenceCapableRootClass, getSuperKeyClass, isKnownUnenhancableClass, isPersistenceCapableRootClass
 

Constructor Detail

EnhancerMetaDataPropertyImpl

public EnhancerMetaDataPropertyImpl(java.io.PrintWriter out,
                                    boolean verbose,
                                    java.util.Properties properties)
                             throws EnhancerMetaDataUserException,
                                    EnhancerMetaDataFatalError
Creates an instance.

Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError

EnhancerMetaDataPropertyImpl

public EnhancerMetaDataPropertyImpl(java.io.PrintWriter out,
                                    boolean verbose,
                                    java.lang.String fileName)
                             throws EnhancerMetaDataUserException,
                                    EnhancerMetaDataFatalError
Creates an instance.

Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
Method Detail

getDeclaringClass

public java.lang.String getDeclaringClass(java.lang.String classPath,
                                          java.lang.String fieldName)
                                   throws EnhancerMetaDataUserException,
                                          EnhancerMetaDataFatalError
Returns the JVM-qualified name of the specified field's declaring class. The method first checks whether the class of the specified classPath (the JVM-qualified name) declares such a field. If yes, classPath is returned. Otherwise, it checks its superclasses. The method returns null for an unkown field.

Specified by:
getDeclaringClass in interface EnhancerMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldName - the non-null name of the field
Returns:
the JVM-qualified name of the declararing class of the field, or null if there is no such field.
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError

declareField

public void declareField(java.lang.String classPath,
                         java.lang.String fieldName,
                         java.lang.String signature)
                  throws EnhancerMetaDataUserException,
                         EnhancerMetaDataFatalError
Declares a field to the JDO model passing its type information.

Specified by:
declareField in interface EnhancerMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldName - the non-null name of the field
signature - the non-null JVM signature of the field
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isPersistenceCapableClass(String)

isPersistenceCapableClass

public boolean isPersistenceCapableClass(java.lang.String classPath)
                                  throws EnhancerMetaDataUserException,
                                         EnhancerMetaDataFatalError
Returns whether a class is known to be persistence-capable.

Specified by:
isPersistenceCapableClass in interface EnhancerMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
Returns:
true if this class is persistence-capable; otherwise false
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isKnownUnenhancableClass(String)

isSerializableClass

public boolean isSerializableClass(java.lang.String classPath)
                            throws EnhancerMetaDataUserException,
                                   EnhancerMetaDataFatalError
Returns whether a class implements java.io.Serializable.

Specified by:
isSerializableClass in interface EnhancerMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
Returns:
true if this class is serializable; otherwise false
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError

getPersistenceCapableSuperClass

public java.lang.String getPersistenceCapableSuperClass(java.lang.String classPath)
                                                 throws EnhancerMetaDataUserException,
                                                        EnhancerMetaDataFatalError
Returns the name of the persistence-capable superclass of a class.

Specified by:
getPersistenceCapableSuperClass in interface EnhancerMetaData
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:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isPersistenceCapableClass(String), EnhancerMetaData.getPersistenceCapableRootClass(String)

getSuperClass

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

Specified by:
getSuperClass in interface ExtendedMetaData
Parameters:
classname - the JVM-qualified name of the class
Returns:
the name of the superclass or null if there is none

getKeyClass

public java.lang.String getKeyClass(java.lang.String classPath)
                             throws EnhancerMetaDataUserException,
                                    EnhancerMetaDataFatalError
Returns the name of the key class of a persistence-capable class.

Specified by:
getKeyClass in interface EnhancerMetaData
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:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isPersistenceCapableClass(String)

isKnownNonManagedField

public boolean isKnownNonManagedField(java.lang.String classPath,
                                      java.lang.String fieldName,
                                      java.lang.String fieldSig)
Returns whether a field of a class is known to be non-managed.

Specified by:
isKnownNonManagedField in interface EnhancerMetaData
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:
EnhancerMetaData.isManagedField(String, String), EnhancerMetaData.declareField(String, String, String)

isManagedField

public boolean isManagedField(java.lang.String classPath,
                              java.lang.String fieldName)
Returns whether a field of a class is transient transactional or persistent.

Specified by:
isManagedField in interface EnhancerMetaData
Overrides:
isManagedField in class EnhancerMetaDataBaseModel
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
See Also:
EnhancerMetaData.isManagedField(String, String)

isPersistentField

public boolean isPersistentField(java.lang.String classPath,
                                 java.lang.String fieldName)
                          throws EnhancerMetaDataUserException,
                                 EnhancerMetaDataFatalError
Returns whether a field of a class is known to be persistent.

Specified by:
isPersistentField in interface EnhancerMetaData
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 persistent; otherwise false
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isManagedField(String, String), EnhancerMetaData.declareField(String, String, String)

isTransactionalField

public boolean isTransactionalField(java.lang.String classPath,
                                    java.lang.String fieldName)
                             throws EnhancerMetaDataUserException,
                                    EnhancerMetaDataFatalError
Returns whether a field of a class is known to be transactional.

Specified by:
isTransactionalField in interface EnhancerMetaData
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 transactional; otherwise false
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isManagedField(String, String), EnhancerMetaData.declareField(String, String, String)

isKeyField

public boolean isKeyField(java.lang.String classPath,
                          java.lang.String fieldName)
                   throws EnhancerMetaDataUserException,
                          EnhancerMetaDataFatalError
Returns whether a field of a class is known to be Primary Key.

Specified by:
isKeyField in interface EnhancerMetaData
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:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isPersistentField(String, String), EnhancerMetaData.declareField(String, String, String)

isDefaultFetchGroupField

public boolean isDefaultFetchGroupField(java.lang.String classPath,
                                        java.lang.String fieldName)
                                 throws EnhancerMetaDataUserException,
                                        EnhancerMetaDataFatalError
Returns whether a field of a class is known to be part of the Default Fetch Group.

Specified by:
isDefaultFetchGroupField in interface EnhancerMetaData
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 part of the default fetch group; otherwise false
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.isPersistentField(String, String), EnhancerMetaData.declareField(String, String, String)

getFieldNumber

public int getFieldNumber(java.lang.String classPath,
                          java.lang.String fieldName)
                   throws EnhancerMetaDataUserException,
                          EnhancerMetaDataFatalError
Returns the unique field index of a declared, persistent field of a class.

Specified by:
getFieldNumber in interface EnhancerMetaData
Parameters:
classPath - the non-null JVM-qualified name of the class
fieldName - the non-null name of the field
Returns:
the non-negative, unique field index or -1 if the field is non-managed
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
EnhancerMetaData.getManagedFields(String), EnhancerMetaData.declareField(String, String, String)

getManagedFields

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

Specified by:
getManagedFields in interface EnhancerMetaData
Parameters:
classname - the non-null JVM-qualified name of the class
Returns:
an array of all declared persistent and transactional fields of a class
See Also:
EnhancerMetaData.getFieldNumber(String, String), EnhancerMetaData.declareField(String, String, String)

getKnownClasses

public final java.lang.String[] getKnownClasses()
Not member of EnhancerMetaData Interface.

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

getKnownFields

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

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

getClassModifiers

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

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

getFieldModifiers

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

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

getFieldType

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

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

getFieldType

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

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

getFieldModifiers

public final int[] getFieldModifiers(java.lang.String classname,
                                     java.lang.String[] fieldnames)
                              throws EnhancerMetaDataUserException,
                                     EnhancerMetaDataFatalError
Description copied from interface: ExtendedMetaData
Gets the modifiers of some fields.

Specified by:
getFieldModifiers in interface ExtendedMetaData
Parameters:
classname - The classname.
fieldnames - The fieldnames.
Returns:
The modifiers.
Throws:
EnhancerMetaDataUserException
EnhancerMetaDataFatalError
See Also:
Modifier

main

public static void main(java.lang.String[] argv)


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.