|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.betwixt.strategy.IdStoringStrategy org.apache.commons.betwixt.strategy.DefaultIdStoringStrategy
public class DefaultIdStoringStrategy
Stores every ID that given to it into an internal HashMap
and
returns it on request.
DefaultIdStoringStrategy(Map, Map)
allows the implementations
to be specified.
For example, those who want to use identity (rather than equality)
should pass a IdentityHashMap
instance.
Field Summary |
---|
Fields inherited from class org.apache.commons.betwixt.strategy.IdStoringStrategy |
---|
DEFAULT |
Constructor Summary | |
---|---|
DefaultIdStoringStrategy()
Constructs a IdStoringStrategy using a HashMap for
storage. |
|
DefaultIdStoringStrategy(java.util.Map idByBeanMap,
java.util.Map beanByIdMap)
Constructs a IdStoringStrategy using the Map
implementations provided for storage. |
Method Summary | |
---|---|
java.lang.Object |
getReferenced(Context context,
java.lang.String id)
Gets an object matching the given reference. |
java.lang.String |
getReferenceFor(Context context,
java.lang.Object bean)
Returns a String id for the given bean if it has been stored previously. |
void |
reset()
Clears all beans. |
void |
setReference(Context context,
java.lang.Object bean,
java.lang.String id)
Stores an ID for the given instance and context. |
Methods inherited from class org.apache.commons.betwixt.strategy.IdStoringStrategy |
---|
createDefault |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultIdStoringStrategy()
IdStoringStrategy
using a HashMap
for
storage.
public DefaultIdStoringStrategy(java.util.Map idByBeanMap, java.util.Map beanByIdMap)
IdStoringStrategy
using the Map
implementations provided for storage.
idByBeanMap
- Map
implementation stores the ID's by beanbeanByIdMap
- Map
implementation stores the bean's by IDMethod Detail |
---|
public java.lang.String getReferenceFor(Context context, java.lang.Object bean)
getReferenceFor
in class IdStoringStrategy
context
- current context, not nullbean
- the instance, not null
IdStoringStrategy.getReferenceFor(org.apache.commons.betwixt.expression.Context,
java.lang.Object)
public void setReference(Context context, java.lang.Object bean, java.lang.String id)
setReference
in class IdStoringStrategy
context
- current context, not nullbean
- current instance, not nullid
- the ID to storeIdStoringStrategy.setReference(org.apache.commons.betwixt.expression.Context,
java.lang.Object, java.lang.String)
public java.lang.Object getReferenced(Context context, java.lang.String id)
getReferenced
in class IdStoringStrategy
context
- Context
, not nullid
- the reference id
public void reset()
reset
in class IdStoringStrategy
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |