org.apache.jdo.impl.model.java.reflection
Class ReflectionJavaField

java.lang.Object
  extended by org.apache.jdo.impl.model.java.AbstractJavaField
      extended by org.apache.jdo.impl.model.java.BaseReflectionJavaField
          extended by org.apache.jdo.impl.model.java.reflection.ReflectionJavaField
All Implemented Interfaces:
JavaField

public class ReflectionJavaField
extends BaseReflectionJavaField

A reflection based JavaField implementation used at runtime. The implementation takes java.lang.reflect.Field instances to get Java related metadata about fields.

Since:
JDO 1.1
Author:
Michael Bouschen

Field Summary
protected  JDOField jdoField
          The corresponding JDO metadata.
 
Fields inherited from class org.apache.jdo.impl.model.java.BaseReflectionJavaField
type
 
Constructor Summary
ReflectionJavaField(java.lang.reflect.Field field, JavaType declaringClass)
          Constructor for fields w/o JDO metadata.
ReflectionJavaField(JDOField jdoField, JavaType declaringClass)
          Constructor for fields having JDO metadata.
ReflectionJavaField(JDOField jdoField, JavaType type, JavaType declaringClass)
          Constructor for fields having JDO metadata.
 
Method Summary
protected  JavaType getJavaTypeInternal(java.lang.Class clazz)
          Returns a JavaType instance for the specified Class object.
 JDOField getJDOField()
          Returns the JDOField instance if this JavaField represents a managed field of a persistence capable class.
 JavaType getType()
          Returns the JavaType representation of the field type.
 
Methods inherited from class org.apache.jdo.impl.model.java.BaseReflectionJavaField
ensureInitializedField, getDeclaredFieldPrivileged, getField, getModifiers
 
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaField
equals, getDeclaringClass, getName, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

jdoField

protected JDOField jdoField
The corresponding JDO metadata.

Constructor Detail

ReflectionJavaField

public ReflectionJavaField(java.lang.reflect.Field field,
                           JavaType declaringClass)
Constructor for fields w/o JDO metadata.

Parameters:
field - the reflection field representation.
declaringClass - the JavaType of the class that declares the field.

ReflectionJavaField

public ReflectionJavaField(JDOField jdoField,
                           JavaType declaringClass)
Constructor for fields having JDO metadata. The constructor takes the field type from the JDO metadata.

Parameters:
jdoField - the JDO field metadata.
declaringClass - the JavaType of the class that declares the field.

ReflectionJavaField

public ReflectionJavaField(JDOField jdoField,
                           JavaType type,
                           JavaType declaringClass)
Constructor for fields having JDO metadata.

Parameters:
jdoField - the JDO field metadata.
type - the field type.
declaringClass - the JavaType of the class that declares the field.
Method Detail

getType

public JavaType getType()
Returns the JavaType representation of the field type.

Specified by:
getType in interface JavaField
Overrides:
getType in class BaseReflectionJavaField
Returns:
field type

getJDOField

public JDOField getJDOField()
Returns the JDOField instance if this JavaField represents a managed field of a persistence capable class. The method returns null, if this JavaField does not represent a managed field.

The method throws a ModelFatalException, if there is a problem accessing the JDO meta data for this JavaField.

Specified by:
getJDOField in interface JavaField
Overrides:
getJDOField in class AbstractJavaField
Returns:
the JDOField instance if this JavaField represents a managed field; null otherwise.

getJavaTypeInternal

protected JavaType getJavaTypeInternal(java.lang.Class clazz)
Returns a JavaType instance for the specified Class object. This method provides a hook such that ReflectionJavaField subclasses can implement their own mapping of Class objects to JavaType instances.



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