org.apache.ojb.broker.metadata.fieldaccess
Class PersistentFieldAutoProxyImpl

java.lang.Object
  extended by org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldBase
      extended by org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldAutoProxyImpl
All Implemented Interfaces:
Serializable, PersistentField
Direct Known Subclasses:
PersistentFieldAutoProxyImplNew

public class PersistentFieldAutoProxyImpl
extends PersistentFieldBase

PeristentField implementation that attempts to detect the nature of the field it is persisting.

First checks to see if it is a Field, then Property, then DynaBean

It will match in that order.

See Also:
Serialized Form

Nested Class Summary
(package private) static class PersistentFieldAutoProxyImpl.AutoDetectException
           
(package private) static class PersistentFieldAutoProxyImpl.ExceptionWrapper
           
 
Field Summary
private  PersistentField currentPF
           
(package private)  int index
           
private  PersistentFieldAutoProxyImpl.ExceptionWrapper latestException
           
protected  Class[] persistentFieldClasses
          Define the number and ordering of the used PersistentField implementaions.
(package private) static long serialVersionUID
           
 
Fields inherited from class org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldBase
PATH_TOKEN, rootObjectType
 
Constructor Summary
PersistentFieldAutoProxyImpl()
           
PersistentFieldAutoProxyImpl(Class clazz, String fieldname)
           
 
Method Summary
private  PersistentField createPersistentFieldForIndex()
           
 Object get(Object anObject)
          Returns the value of the field represented by this PersistentField, on the specified object.
private  PersistentField getCurrent()
           
 Class getType()
           
private  void handleException(String message, Exception e)
           
protected  boolean makeAccessible()
          A value of true indicates that this field should suppress Java language access checking when it is used.
private  PersistentField newInstance(Class pfClass)
           
 void set(Object obj, Object value)
          Sets the field represented by this PersistentField object on the specified object argument to the specified new value.
 boolean usesAccessorsAndMutators()
           
 
Methods inherited from class org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldBase
buildErrorGetMsg, buildErrorSetMsg, getDeclaringClass, getFieldGraph, getLog, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

persistentFieldClasses

protected Class[] persistentFieldClasses
Define the number and ordering of the used PersistentField implementaions. Override this field to add new classes or to change setection order.


currentPF

private PersistentField currentPF

latestException

private PersistentFieldAutoProxyImpl.ExceptionWrapper latestException

index

int index
Constructor Detail

PersistentFieldAutoProxyImpl

public PersistentFieldAutoProxyImpl()

PersistentFieldAutoProxyImpl

public PersistentFieldAutoProxyImpl(Class clazz,
                                    String fieldname)
Method Detail

getCurrent

private PersistentField getCurrent()

handleException

private void handleException(String message,
                             Exception e)

get

public Object get(Object anObject)
           throws MetadataException
Description copied from interface: PersistentField
Returns the value of the field represented by this PersistentField, on the specified object. This implementation invokes get() on its underlying Field object.

Parameters:
anObject - - The object instance (proxy objects are not allowed here) which we are trying to get the field value from.
Throws:
MetadataException - if there is an error getting this field value from obj
See Also:
Field

set

public void set(Object obj,
                Object value)
         throws MetadataException
Description copied from interface: PersistentField
Sets the field represented by this PersistentField object on the specified object argument to the specified new value. The new value is automatically unwrapped if the underlying field has a primitive type. This implementation invokes set() on its underlying Field object if the argument is not null. OBS IllegalArgumentExceptions are wrapped as PersistenceBrokerExceptions.

Parameters:
obj - The target object (no proxy objects allowed).
value - The value to set.
Throws:
MetadataException - if there is an error setting this field value on obj
See Also:
Field

getType

public Class getType()

makeAccessible

protected boolean makeAccessible()
Description copied from class: PersistentFieldBase
A value of true indicates that this field should suppress Java language access checking when it is used.

Specified by:
makeAccessible in class PersistentFieldBase

usesAccessorsAndMutators

public boolean usesAccessorsAndMutators()

createPersistentFieldForIndex

private PersistentField createPersistentFieldForIndex()
                                               throws Exception
Throws:
Exception

newInstance

private PersistentField newInstance(Class pfClass)
                             throws Exception
Throws:
Exception


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.