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

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

public class PersistentFieldIntrospectorImpl
extends PersistentFieldBase

A PersistentField implementation using JavaBeans compliant calls only to access persistent attributes. No Reflection is needed. But for each attribute xxx there must be public getXxx() and setXxx() methods. In metadata the field name must be the bean compliant 'xxx'.

Version:
$Id: PersistentFieldIntrospectorImpl.java,v 1.1 2007-08-24 22:17:35 ewestfal Exp $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.ojb.broker.metadata.fieldaccess.PersistentFieldBase
PATH_TOKEN, rootObjectType
 
Constructor Summary
PersistentFieldIntrospectorImpl()
           
PersistentFieldIntrospectorImpl(Class aClass, String aPropertyName)
           
 
Method Summary
protected static PropertyDescriptor findPropertyDescriptor(Class aClass, String aPropertyName)
          Get the PropertyDescriptor for aClass and aPropertyName
 Object get(Object target)
          Returns the value of the field represented by this PersistentField, on the specified object.
protected  PropertyDescriptor getPropertyDescriptor()
          Returns the PropertyDescriptor.
 Class getType()
           
protected  void logProblem(PropertyDescriptor pd, Object anObject, Object aValue, String msg)
          Let's give the user some hints as to what could be wrong.
 boolean makeAccessible()
          This implementation returns always 'false'.
 void set(Object target, Object value)
          Sets the field represented by this PersistentField object on the specified object argument to the specified new value.
 boolean usesAccessorsAndMutators()
          Always returns 'false'.
 
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
 

Constructor Detail

PersistentFieldIntrospectorImpl

public PersistentFieldIntrospectorImpl()

PersistentFieldIntrospectorImpl

public PersistentFieldIntrospectorImpl(Class aClass,
                                       String aPropertyName)
Method Detail

getType

public Class getType()

set

public void set(Object target,
                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:
target - 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

get

public Object get(Object target)
           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:
target - - 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

findPropertyDescriptor

protected static PropertyDescriptor findPropertyDescriptor(Class aClass,
                                                           String aPropertyName)
Get the PropertyDescriptor for aClass and aPropertyName


getPropertyDescriptor

protected PropertyDescriptor getPropertyDescriptor()
Returns the PropertyDescriptor.

Returns:
java.beans.PropertyDescriptor

makeAccessible

public boolean makeAccessible()
This implementation returns always 'false'.

Specified by:
makeAccessible in class PersistentFieldBase

usesAccessorsAndMutators

public boolean usesAccessorsAndMutators()
Always returns 'false'.

See Also:
PersistentField.usesAccessorsAndMutators()

logProblem

protected void logProblem(PropertyDescriptor pd,
                          Object anObject,
                          Object aValue,
                          String msg)
Let's give the user some hints as to what could be wrong.



Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.