org.apache.cayenne.property
Class PropertyUtils

java.lang.Object
  extended by org.apache.cayenne.property.PropertyUtils

public class PropertyUtils
extends java.lang.Object

Utility methods to quickly access object properties. This class supports simple and nested properties and also conversion of property values to match property type. No converter customization is provided yet, so only basic converters for Strings, Numbers and primitives are available.

Since:
1.2
Author:
Andrus Adamchik

Method Summary
static java.lang.Object getProperty(java.lang.Object object, java.lang.String nestedPropertyName)
          Returns object property using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.
static void setProperty(java.lang.Object object, java.lang.String nestedPropertyName, java.lang.Object value)
          Sets object property using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProperty

public static java.lang.Object getProperty(java.lang.Object object,
                                           java.lang.String nestedPropertyName)
                                    throws CayenneRuntimeException
Returns object property using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path.

Throws:
CayenneRuntimeException

setProperty

public static void setProperty(java.lang.Object object,
                               java.lang.String nestedPropertyName,
                               java.lang.Object value)
                        throws CayenneRuntimeException
Sets object property using JavaBean-compatible introspection with one addition - a property can be a dot-separated property name path. Before setting a value attempts to convert it to a type compatible with the object property. Automatic conversion is supported between strings and basic types like numbers or primitives.

Throws:
CayenneRuntimeException


Copyright © 2001-2006 Apache.org All Rights Reserved.