net.sf.fikin.pojostate.state
Class SnapshotState

java.lang.Object
  extended by net.sf.fikin.pojostate.state.AbstractState
      extended by net.sf.fikin.pojostate.state.SnapshotState
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable, java.util.Collection, State, StatePrototype

public class SnapshotState
extends AbstractState

Static state information obtained from the POJO.

It maintains a permanent reference to the underlying POJO.

It takes a snapshot of all Property values at once, upon a call to update(). Later calls to SnapshotState.StaticProperty.getValue() result in returning already obtained value.

This type of behavior is useful when there is infrequent change of POJO state and generally there are frequent reads of Property values. created on Mar 1, 2007

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

Nested Class Summary
 class SnapshotState.StaticProperty
          Implements read-once method value, executed upon object construction time created on Mar 1, 2007
 
Nested classes/interfaces inherited from class net.sf.fikin.pojostate.state.AbstractState
AbstractState.PropertyNameComparator
 
Field Summary
 
Fields inherited from interface net.sf.fikin.pojostate.State
SORT_ASC, SORT_BY_DESC, SORT_BY_NAME, SORT_BY_VALUE, SORT_DESC
 
Constructor Summary
SnapshotState()
           
 
Method Summary
 Property newProperty(MethodMeta mm)
          instantiate new SnapshotState.StaticProperty object
 void update()
          Update the state of all Properties.
 
Methods inherited from class net.sf.fikin.pojostate.state.AbstractState
add, add, addAll, clear, clone, contains, containsAll, getClassLoader, getFormat, getLocale, getObject, getProperties, getProperty, isEmpty, iterator, remove, removeAll, retainAll, setClassLoader, setFormat, setLocale, setObject, setProperties, size, sort, sortArray, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

SnapshotState

public SnapshotState()
Method Detail

update

public void update()
            throws DecorationException
Update the state of all Properties.

Throws:
DecorationException

newProperty

public Property newProperty(MethodMeta mm)
                     throws DecorationException
instantiate new SnapshotState.StaticProperty object

Parameters:
mm - attached to that Property
Throws:
DecorationException - in case of internal error


Copyright © 2005 Nikolay Fiykov. All Rights Reserved.