public class DuplicateResourceFactoryBean extends GateAwareObject implements org.springframework.beans.factory.FactoryBean, org.springframework.beans.factory.DisposableBean
Constructor and Description |
---|
DuplicateResourceFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Delete the duplicates we have returned, unless they have already
been freed.
|
Object |
getObject() |
Class<?> |
getObjectType()
Returns a proxy class that implements the same set of GATE
interfaces as the template resource.
|
boolean |
isSingleton()
This factory is not a singleton - it produces a new object each
time
getObject() is called. |
void |
setCustomisers(List<ResourceCustomiser> customisers)
Optional customisers that will be applied to the duplicate resource
before it is returned.
|
void |
setReturnTemplate(boolean returnTemplate)
Should this factory bean return the template resource itself the
first time
getObject() is called, or should it always
return a duplicate, keeping the template in pristine condition. |
void |
setTemplate(gate.Resource template)
Set the template resource that this factory bean will duplicate.
|
ensureGateInit, setBeanFactory
public void setTemplate(gate.Resource template)
public void setReturnTemplate(boolean returnTemplate)
getObject()
is called, or should it always
return a duplicate, keeping the template in pristine condition.
Generally, if the duplicates will all be created up-front, and
there are no configured customisers, then it is safe to set this
option to true. In cases where the duplicates may be created
asynchronously (possibly creating one duplicate while another one
is in use in a different thread) or may be customised after
creation it is safer to set this option to false (the default) to
keep the template pristine and always return duplicates.public void setCustomisers(List<ResourceCustomiser> customisers)
false
.public Object getObject() throws Exception
getObject
in interface org.springframework.beans.factory.FactoryBean
Exception
public Class<?> getObjectType()
Factory.duplicate(Resource)
for the list of interfaces that
will be considered.getObjectType
in interface org.springframework.beans.factory.FactoryBean
public boolean isSingleton()
getObject()
is called.isSingleton
in interface org.springframework.beans.factory.FactoryBean
public void destroy()
destroy
in interface org.springframework.beans.factory.DisposableBean
Copyright © 2023 GATE. All rights reserved.