Package org.chenile.stm.impl
Class CreateOrUseExistingObjectRule<T>
java.lang.Object
org.apache.commons.digester.Rule
org.apache.commons.digester.ObjectCreateRule
org.chenile.stm.impl.CreateOrUseExistingObjectRule<T>
- Type Parameters:
T
-
public class CreateOrUseExistingObjectRule<T>
extends org.apache.commons.digester.ObjectCreateRule
Useful as an enhancement over the ObjectCreateRule for digester. This one creates a new object or uses an existing one if an old one
was already created using the same ID. The ID has to be an attribute for the given xml tag. Its name is "id" by default
but can be changed to something else if required. The finderMethod is
the method to call on the previous object in the digester stack ( the object that is assumed to "collect" all the IDs so far)
to obtain the
old object if an old object was already created for that Id. The finderMethod must accept the "id" and nothing else and return the
already created object.
Only string ids are supported.
- Author:
- Raja Shankar Kolluru
-
Field Summary
Fields inherited from class org.apache.commons.digester.ObjectCreateRule
attributeName, className
Fields inherited from class org.apache.commons.digester.Rule
digester, namespaceURI
-
Constructor Summary
ConstructorDescriptionCreateOrUseExistingObjectRule
(Class<T> whichClazz, String finderMethod) CreateOrUseExistingObjectRule
(Class<T> whichClazz, String finderMethod, String idAttributeName) -
Method Summary
Methods inherited from class org.apache.commons.digester.ObjectCreateRule
end, toString
Methods inherited from class org.apache.commons.digester.Rule
begin, body, body, end, finish, getDigester, getNamespaceURI, setDigester, setNamespaceURI
-
Field Details
-
ID
- See Also:
-
finderMethod
-
classToCreate
-
idAttributeName
-
-
Constructor Details
-
CreateOrUseExistingObjectRule
-
CreateOrUseExistingObjectRule
-
-
Method Details
-
begin
- Overrides:
begin
in classorg.apache.commons.digester.ObjectCreateRule
- Throws:
Exception
-