@PersistantProperties(properties=@PersistantProperty(property="source")) public abstract class AbstractReadSourceAccessor extends AbstractReadAccessor implements IAccessorValueHandler
IReadAccessor.Standalone
Modifier and Type | Field and Description |
---|---|
protected Class<?> |
internalExpectedGenericType |
protected Class<?> |
internalExpectedType |
protected IReadAccessor |
source |
Constructor and Description |
---|
AbstractReadSourceAccessor() |
AbstractReadSourceAccessor(IReadAccessor source) |
Modifier and Type | Method and Description |
---|---|
AbstractReadSourceAccessor |
clone()
Clones the Addon.
|
boolean |
equals(Object o) |
CostInfo |
getEstimatedReadCost(ICompilationContext ctxt)
Returns source's cost + 1.
|
Class<?> |
getGenericCollectionType(IContext ctxt)
Returns requested generic type if any, otherwise the source's generic type if any.
|
Integer |
getInternalCacheIdentifier()
Returns null by default.
|
IReadAccessor |
getSource() |
Class<?> |
getType(IContext ctxt)
Returns requested type if any, otherwise the source's type if any.
|
Object |
handleValue(IExecutionContext ctxt,
Object value)
If value is a collection an collections should be parsed, calls
specificHandleValue(IExecutionContext, Object)
for all elements in collection. |
int |
hashCode() |
protected Object |
internalGet(IExecutionContext ctxt)
If source should iterate, calls handleValue for all elements.
|
boolean |
isCacheUsed()
Returns false by default.
|
boolean |
isConstantValue()
Default implementation returns "false".
|
boolean |
isInternalCacheIdentifierNeeded()
This method allows to tell the engine if a cache identifier is needed.
|
boolean |
isShouldIterate()
True if source should be iterated.
|
protected abstract boolean |
parseCollections()
If true, collection returned by source accessor will be parsed and
specificHandleValue(IExecutionContext, Object)
will be invoked for each values. |
void |
resetCachedData(IExecutionContext ctxt)
Does nothing.
|
void |
setInternalCacheIdentifier(Integer internalIdentifier)
Stores nothing.
|
void |
setSource(IReadAccessor source) |
protected abstract Object |
specificHandleValue(IExecutionContext ctxt,
Object value)
Override this to apply specific transformation on value read from source accessor.
|
void |
toString(OuterWithLevel outer)
Method used to send String representation of the current object to the
OuterWithLevel . |
boolean |
wasRegistered(ICompilationContext ctxt,
IAddon parent,
AddonInfo info)
Convenience method, which does nothing.
|
castToExpected, compileCollection, compileRead, compileRead, compileRead, compileRead, compileValue, get, getGenericTypes, isShouldBeWrappedToConstantValue, isShouldNotCache
optimize, toString
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
finalize, getClass, notify, notifyAll, wait, wait, wait
getImplementationId, optimize
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
protected IReadAccessor source
protected transient Class<?> internalExpectedType
protected transient Class<?> internalExpectedGenericType
public AbstractReadSourceAccessor()
public AbstractReadSourceAccessor(IReadAccessor source)
public CostInfo getEstimatedReadCost(ICompilationContext ctxt) throws MRuleValidationException
getEstimatedReadCost
in interface IReadAccessor
ctxt
- Compilation context.MRuleValidationException
- if validation problem detected.public boolean wasRegistered(ICompilationContext ctxt, IAddon parent, AddonInfo info)
AbstractAddon
wasRegistered
in interface IAddon
wasRegistered
in class AbstractAddon
parent
- Parent from which this instance of addon was registered.info
- Addon info for the currently registered addonpublic void resetCachedData(IExecutionContext ctxt)
AbstractAddon
resetCachedData
in interface IAddon
resetCachedData
in class AbstractAddon
protected Object internalGet(IExecutionContext ctxt) throws MAccessorException
internalGet
in class AbstractReadAccessor
MAccessorException
public Object handleValue(IExecutionContext ctxt, Object value) throws MAccessorException
specificHandleValue(IExecutionContext, Object)
for all elements in collection.
Otherwise calls it only once for the value.handleValue
in interface IAccessorValueHandler
MAccessorException
protected abstract boolean parseCollections()
specificHandleValue(IExecutionContext, Object)
will be invoked for each values. Otherwise, specificHandleValue(IExecutionContext, Object)
will be invoked only once
directly with the result of the source accessor.protected abstract Object specificHandleValue(IExecutionContext ctxt, Object value) throws MAccessorException
MAccessorException
public Class<?> getType(IContext ctxt) throws MAccessorException
getType
in interface IAccessor
MAccessorException
public Class<?> getGenericCollectionType(IContext ctxt) throws MAccessorException
getGenericCollectionType
in interface IAccessor
MAccessorException
public boolean isShouldIterate()
isShouldIterate
in interface IReadAccessor
public final void setInternalCacheIdentifier(Integer internalIdentifier)
AbstractAddon
setInternalCacheIdentifier
in interface IAddon
setInternalCacheIdentifier
in class AbstractAddon
internalIdentifier
- Internal identifierIAddon.getInternalCacheIdentifier()
public final Integer getInternalCacheIdentifier()
AbstractAddon
getInternalCacheIdentifier
in interface IAddon
getInternalCacheIdentifier
in class AbstractAddon
IAddon.setInternalCacheIdentifier(Integer)
public boolean isInternalCacheIdentifierNeeded()
AbstractAddon
isInternalCacheIdentifierNeeded
in interface IAddon
isInternalCacheIdentifierNeeded
in class AbstractAddon
AbstractAddon.setInternalCacheIdentifier(Integer)
public AbstractReadSourceAccessor clone()
IAddon
clone
in interface IAccessor
clone
in interface IReadAccessor
clone
in interface IAddon
clone
in interface IMRulesObject
clone
in class AbstractReadAccessor
public void toString(OuterWithLevel outer) throws IOException
Outable
OuterWithLevel
.toString
in interface Outable
IOException
public boolean isConstantValue()
AbstractReadAccessor
isConstantValue
in interface IReadAccessor
isConstantValue
in class AbstractReadAccessor
public boolean isCacheUsed()
AbstractAddon
isCacheUsed
in interface IAddon
isCacheUsed
in class AbstractAddon
public IReadAccessor getSource()
public void setSource(IReadAccessor source)