net.sf.fikin.pojostate.state
Class AbstractDecoratorProperty

java.lang.Object
  extended by net.sf.fikin.pojostate.state.AbstractDecoratorProperty
All Implemented Interfaces:
java.lang.Comparable, MethodMeta, Property
Direct Known Subclasses:
DynamicState.DynamicProperty, SnapshotState.StaticProperty

public abstract class AbstractDecoratorProperty
extends java.lang.Object
implements Property, java.lang.Comparable

Prototype of Property methods.

Name, description and format are based on decorating an assigned MethodMeta object.

Subclasses are expected to implement getValue(). created on Mar 1, 2007

Since:
Version:
$Revision: 1.1 $
Author:
fiykov

Constructor Summary
AbstractDecoratorProperty(MethodMeta method)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          compare to the given object The comparison logic as following: If the object is another Property it will compare getName() If the object is a lava.lang.String it will compare it to getName() In all other cases it will throw ClassCastException
 java.lang.String getDescription()
          get key's description if any
 java.text.Format getFormat()
          get key's description if any
 java.lang.reflect.Method getMethod()
          Underlying java.lang.reflect.method object, represented by this Property
 MethodMeta getMethodMeta()
           
 java.lang.String getName()
          get key's name
protected  java.lang.String obtainValue(java.lang.Object pojo)
          prototype method implementing actual method execution, obtaining the result and applying formatting to it before returning it to the caller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.fikin.pojostate.Property
getValue
 

Constructor Detail

AbstractDecoratorProperty

public AbstractDecoratorProperty(MethodMeta method)
Method Detail

getName

public java.lang.String getName()
get key's name

Specified by:
getName in interface MethodMeta
Returns:
key's short name

getDescription

public java.lang.String getDescription()
get key's description if any

Specified by:
getDescription in interface MethodMeta
Returns:
key's description

getFormat

public java.text.Format getFormat()
get key's description if any

Specified by:
getFormat in interface MethodMeta
Returns:
key's description

getMethodMeta

public MethodMeta getMethodMeta()
Returns:
assigned MethodMeta object

getMethod

public java.lang.reflect.Method getMethod()
Description copied from interface: MethodMeta
Underlying java.lang.reflect.method object, represented by this Property

Specified by:
getMethod in interface MethodMeta
Returns:
underlying java.lang.Method object

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
compare to the given object

The comparison logic as following:

Specified by:
compareTo in interface java.lang.Comparable
Returns:
-1, 1 or 0
Throws:
java.lang.ClassCastException

obtainValue

protected java.lang.String obtainValue(java.lang.Object pojo)
                                throws DecorationException
prototype method implementing actual method execution, obtaining the result and applying formatting to it before returning it to the caller

Returns:
formatted method value
Throws:
DecorationException


Copyright © 2005 Nikolay Fiykov. All Rights Reserved.