org.springframework.extensions.surf
Class ModelHelper

java.lang.Object
  extended by org.springframework.extensions.surf.ModelHelper

public final class ModelHelper
extends Object

Static Utility class that provides reflection against the public properties of a given object. This class provides methods for checking whether a given property name is declared as a model variable. Model variables are defined on ModelObject derived types as variables that begin with a "PROP_" prefix. The code walks the class chain and picks out which variables are model specific and which ones are custom. The results are stored in look-up tables so that subsequent lookups will simply hit the cache. This is perfectly fine since model definitions do not change at runtime.

Author:
muzquiano

Constructor Summary
ModelHelper()
           
 
Method Summary
static boolean isCustomProperty(ModelObject object, String propertyName)
          Determines whether the given property is a custom property for the given object
static boolean isModelProperty(ModelObject object, String propertyName)
          Determines whether the given property is a non-custom (or model) property for the given object.
static String newGUID()
          Builds a new GUID
static void resetId(ModelObject object, String id)
          Allows model object ids to be set manually
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelHelper

public ModelHelper()
Method Detail

isCustomProperty

public static boolean isCustomProperty(ModelObject object,
                                       String propertyName)
Determines whether the given property is a custom property for the given object

Parameters:
object - the object
propertyName - the property name
Returns:
true, if is custom property

isModelProperty

public static boolean isModelProperty(ModelObject object,
                                      String propertyName)
Determines whether the given property is a non-custom (or model) property for the given object.

Parameters:
object - the object
propertyName - the property name
Returns:
true, if is model property

newGUID

public static String newGUID()
Builds a new GUID

Returns:
the string

resetId

public static void resetId(ModelObject object,
                           String id)
Allows model object ids to be set manually

Parameters:
object -
id -


Copyright © 2009 SpringSource, Inc. All Rights Reserved.