net.sf.fikin.pojostate
Interface State

All Superinterfaces:
java.util.Collection, java.lang.Iterable
All Known Subinterfaces:
BindedState, StatePrototype
All Known Implementing Classes:
AbstractState, DynamicState, EmptyState, SnapshotState

public interface State
extends java.util.Collection

State of an object (POJO).

State represent:

State objects offer services related to:

Actual State objects are instantiated by Decorator objects during POJO decoration. created on Jun 22, 2005

Since:
Version:
$Revision: 1.5 $
Author:
fiykov

Field Summary
static int SORT_ASC
          constant defining the sorting order is to be "ascending"
static int SORT_BY_DESC
          constant defining the collection is to be sorted by MethodMeta.getDescription()
static int SORT_BY_NAME
          constant defining the collection is to be sorted by MethodMeta.getName()
static int SORT_BY_VALUE
          constant defining the collection is to be sorted by Property.getValue()
static int SORT_DESC
          constant defining the sorting order is to be "descending"
 
Method Summary
 java.lang.ClassLoader getClassLoader()
           
 StateFormat getFormat()
          get state's formatting object Formatting object is responsible to convey this State object to a string representation.
 java.util.Locale getLocale()
           
 java.lang.Object getObject()
           
 Property getProperty(java.lang.String propertyName)
          find the property with that name from the collection
 void sort(int leadField, int order)
          Sort the collection in given order
 java.lang.String toString()
          print the collection of Properties This representation may vary depending on the getFormat() object.
 void update()
          Update the state of the object.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Field Detail

SORT_BY_NAME

static final int SORT_BY_NAME
constant defining the collection is to be sorted by MethodMeta.getName()

See Also:
Constant Field Values

SORT_BY_DESC

static final int SORT_BY_DESC
constant defining the collection is to be sorted by MethodMeta.getDescription()

See Also:
Constant Field Values

SORT_BY_VALUE

static final int SORT_BY_VALUE
constant defining the collection is to be sorted by Property.getValue()

See Also:
Constant Field Values

SORT_ASC

static final int SORT_ASC
constant defining the sorting order is to be "ascending"

See Also:
Constant Field Values

SORT_DESC

static final int SORT_DESC
constant defining the sorting order is to be "descending"

See Also:
Constant Field Values
Method Detail

getClassLoader

java.lang.ClassLoader getClassLoader()
Returns:
Returns the class loader.

getLocale

java.util.Locale getLocale()
Returns:
Returns the locale.

getObject

java.lang.Object getObject()
Returns:
the object which state this is

getFormat

StateFormat getFormat()
get state's formatting object

Formatting object is responsible to convey this State object to a string representation. >Typical layout formats is to be expected to be tabular text, XML, HTML or similar.

This object is used by toString() too.

Returns:
the object used to format the state UI appearance

sort

void sort(int leadField,
          int order)
Sort the collection in given order

Parameters:
leadField - is one of SORT_BY_NAME,SORT_BY_DESC or SORT_BY_VALUE
order - is one of SORT_ASC or SORT_DESC

getProperty

Property getProperty(java.lang.String propertyName)
find the property with that name from the collection

Parameters:
propertyName - as given by MethodMeta.getName().
Returns:
the property or null if no such property exists.

update

void update()
            throws DecorationException
Update the state of the object.

The idea of this method is to allow for state update is that is possible. This way State objects became reusable.

This method is subject to different implementation variations. For example, snapshot type of States might be able to refresh state but dynamic generally do not need this.

Throws:
DecorationException

toString

java.lang.String toString()
print the collection of Properties

This representation may vary depending on the getFormat() object.

Overrides:
toString in class java.lang.Object
Returns:
formatted string of the current state


Copyright © 2005 Nikolay Fiykov. All Rights Reserved.