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

java.lang.Object
  extended by org.apache.jdo.impl.model.java.AbstractJavaMember
      extended by org.apache.jdo.impl.model.java.BaseReflectionJavaField
          extended by org.apache.jdo.impl.model.java.reflection.ReflectionJavaField
All Implemented Interfaces:
JavaElement, JavaField, JavaMember

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
Version:
JDO 2.0
Author:
Michael Bouschen

Field Summary
 
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(java.lang.String fieldName, JavaType type, JavaType declaringClass)
          Constructor for fields having JDO metadata.
 
Method Summary
 JavaType getJavaTypeForClass(java.lang.Class clazz)
          Returns a JavaType instance for the specified Class object.
 JavaType getType()
          Returns the JavaType representation of the field type.
 
Methods inherited from class org.apache.jdo.impl.model.java.BaseReflectionJavaField
ensureInitializedField, getDeclaredFieldPrivileged, getDeclaredFieldsPrivileged, getField, getModifiers, getUnderlyingObject
 
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaMember
equals, getComponentType, getDeclaringClass, getName, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jdo.model.java.JavaMember
getComponentType, getDeclaringClass, getName
 

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(java.lang.String fieldName,
                           JavaType type,
                           JavaType declaringClass)
Constructor for fields having JDO metadata.

Parameters:
fieldName - the name of the field.
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 JavaMember
Overrides:
getType in class BaseReflectionJavaField
Returns:
field type

getJavaTypeForClass

public JavaType getJavaTypeForClass(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-2008 Apache Software Foundation. All Rights Reserved.