@PersistantProperty(property="property") @PersistantProperty(property="source") @PersistantProperty(property="optimizeMultiRead",defaultValue="true") public class MPropertyAccessor extends AbstractReadAccessor implements IReadAccessor.Standalone, IReadWriteAccessor, IAccessorValueHandler
context.getReadBase().getProperty1().getProperty2()
context.getReadBase().getMapProperty().get("propertyName")
context.getReadBase().getMapProperty().get("propertyName")
context.getReadBase().getMapProperty().get(context.getReadBase().getSubProperty1().getSubProperty2())
IReadAccessor.Standalone
Modifier and Type | Field and Description |
---|---|
static String |
PROPERTY_FEATURE
The value of this constant ("property-access") allows to disable caching
of property access results, meaning that the value returned by the accessed method will
not be cached, but the value returned by the property accessor might be cached to avoid
multiple casts of the same values.
|
static String |
PROPERTY_ID |
Constructor and Description |
---|
MPropertyAccessor() |
MPropertyAccessor(IReadAccessor source)
Property has to be set later.
|
MPropertyAccessor(IReadAccessor source,
String property) |
MPropertyAccessor(String property) |
Modifier and Type | Method and Description |
---|---|
MPropertyAccessor |
clone()
Clones the Addon.
|
<G,C extends Collection<G>> |
compileCollection(ICompilationContext ctxt,
Class<C> expectedType,
Class<G> expectedGenericType)
Implementation to handle case when expected result is a Collection.
|
void |
compileReadWrite(ICompilationContext ctxt,
boolean forReadTarget)
Compiles this accessor to get or set a value.
|
void |
compileValue(ICompilationContext ctxt,
Class<?> expectedType)
Implementation to handle case when expected result is a single value.
|
void |
compileWrite(ICompilationContext ctxt)
Compiles this accessor to set a value.
|
boolean |
equals(Object o) |
Object |
get(IExecutionContext ctxt,
boolean instantiateAll)
Gets the value of the target.
|
CostInfo |
getEstimatedReadCost(ICompilationContext ctxt)
Estimates the reading complexity, to allow callers to optimize calls.
|
Class<?> |
getGenericCollectionType(IContext ctxt)
Returns the Generic type, if value is a collection or an array, evaluated :
at compilation time for standard compilation
at runtime for light compilation and execution phase
or null if the type can't be resolved or value is not a collection.
|
Class<?>[] |
getGenericTypes(IContext ctxt)
By default, creates a 1 cell array with
IAccessor.getGenericCollectionType(IContext) return value if any,
or null if no value. |
String |
getImplementationId()
Unique addon implementation ID.
|
Integer |
getInternalCacheIdentifier()
Returns null by default.
|
String |
getProperty() |
protected PropertyCompiler2 |
getPropertyCompiler(ICompilationContext ctxt)
Allows to override usage of PropertyCompiler2 for this Accessor.
|
IReadAccessor |
getSource() |
Class<?> |
getType(IContext ctxt)
Returns the value's class, evaluated :
at compilation time for standard compilation
at runtime for light compilation
or null if the type can't be resolved.
|
Object |
handleValue(IExecutionContext ctxt,
Object srcValue)
Called for each value of the iterated element.
|
Object |
handleValue(IExecutionContext ctxt,
Object srcValue,
boolean instantiateAll) |
int |
hashCode() |
protected Object |
internalGet(IExecutionContext ctxt)
Specific addon implementation must be here.
|
boolean |
isCacheUsed()
Returns false by default.
|
boolean |
isGlobalVar() |
boolean |
isInternalCacheIdentifierNeeded()
This method allows to tell the engine if a cache identifier is needed.
|
boolean |
isLocalVar() |
boolean |
isOptimizeMultiRead() |
boolean |
isShouldIterate()
If this iterator is dedicated to iterate over values, then it should be precised.
|
boolean |
isVar() |
void |
resetCachedData(IExecutionContext ctxt)
Does nothing.
|
Object |
set(IExecutionContext ctxt,
IReadAccessor accessor)
Sets the value.
|
Object |
set(IExecutionContext ctxt,
Object obj)
Sets the value.
|
void |
setInternalCacheIdentifier(Integer internalIdentifier)
Stores nothing.
|
void |
setOptimizeMultiRead(boolean optimizeMultiRead) |
void |
setProperty(String property) |
void |
setSource(IReadAccessor source) |
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, compileRead, compileRead, compileRead, compileRead, get, isConstantValue, isShouldBeWrappedToConstantValue, isShouldNotCache
optimize, toString
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
finalize, getClass, notify, notifyAll, wait, wait, wait
compileRead, compileRead, compileRead, compileRead, get, isConstantValue, isShouldBeWrappedToConstantValue
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
public static final String PROPERTY_ID
public static final String PROPERTY_FEATURE
public MPropertyAccessor()
public MPropertyAccessor(String property)
public MPropertyAccessor(IReadAccessor source)
public MPropertyAccessor(IReadAccessor source, String property)
public void compileValue(ICompilationContext ctxt, Class<?> expectedType) throws MRuleValidationException
AbstractReadAccessor
compileValue
in class AbstractReadAccessor
MRuleValidationException
public <G,C extends Collection<G>> void compileCollection(ICompilationContext ctxt, Class<C> expectedType, Class<G> expectedGenericType) throws MRuleValidationException
AbstractReadAccessor
compileCollection
in class AbstractReadAccessor
MRuleValidationException
public void compileWrite(ICompilationContext ctxt) throws MRuleValidationException
IWriteAccessor
compileWrite
in interface IWriteAccessor
MRuleValidationException
- if validation problem detected.public void compileReadWrite(ICompilationContext ctxt, boolean forReadTarget) throws MRuleValidationException
IReadWriteAccessor
compileReadWrite
in interface IReadWriteAccessor
forReadTarget
- To choose between read or write base for compilation and execution.MRuleValidationException
- if validation problem detected.protected PropertyCompiler2 getPropertyCompiler(ICompilationContext ctxt)
public boolean wasRegistered(ICompilationContext ctxt, IAddon parent, AddonInfo info) throws MRuleValidationException
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 addonMRuleValidationException
public CostInfo getEstimatedReadCost(ICompilationContext ctxt) throws MRuleValidationException
IReadAccessor
getEstimatedReadCost
in interface IReadAccessor
ctxt
- Compilation context.MRuleValidationException
- if validation problem detected.protected Object internalGet(IExecutionContext ctxt) throws MAccessorException
AbstractReadAccessor
internalGet
in class AbstractReadAccessor
MAccessorException
public Object get(IExecutionContext ctxt, boolean instantiateAll) throws MAccessorException
IReadWriteAccessor
get
in interface IReadWriteAccessor
MAccessorException
public Object handleValue(IExecutionContext ctxt, Object srcValue) throws MAccessorException
IAccessorValueHandler
handleValue
in interface IAccessorValueHandler
MAccessorException
public Object handleValue(IExecutionContext ctxt, Object srcValue, boolean instantiateAll) throws MAccessorException
MAccessorException
public Object set(IExecutionContext ctxt, IReadAccessor accessor) throws MAccessorException
IWriteAccessor
set
in interface IWriteAccessor
MAccessorException
public Object set(IExecutionContext ctxt, Object obj) throws MAccessorException
IWriteAccessor
set
in interface IWriteAccessor
MAccessorException
public Class<?> getType(IContext ctxt) throws MAccessorException
IAccessor
getType
in interface IAccessor
MAccessorException
public Class<?> getGenericCollectionType(IContext ctxt) throws MAccessorException
IAccessor
getGenericCollectionType
in interface IAccessor
MAccessorException
public Class<?>[] getGenericTypes(IContext ctxt) throws MAccessorException
AbstractReadAccessor
IAccessor.getGenericCollectionType(IContext)
return value if any,
or null if no value.getGenericTypes
in interface IAccessor
getGenericTypes
in class AbstractReadAccessor
MAccessorException
public boolean isShouldIterate()
IReadAccessor
MRuleInternalRuntimeException
if Exception must be thrown.isShouldIterate
in interface IReadAccessor
public String getImplementationId()
IAddon
getImplementationId
in interface IAddon
public MPropertyAccessor clone()
IAddon
clone
in interface IAccessor
clone
in interface IReadAccessor
clone
in interface IReadWriteAccessor
clone
in interface IWriteAccessor
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 String getProperty()
public final void setProperty(String property)
public IReadAccessor getSource()
public void setSource(IReadAccessor source)
public boolean isOptimizeMultiRead()
public void setOptimizeMultiRead(boolean optimizeMultiRead)
public void resetCachedData(IExecutionContext ctxt)
AbstractAddon
resetCachedData
in interface IAddon
resetCachedData
in class AbstractAddon
public boolean isCacheUsed()
AbstractAddon
isCacheUsed
in interface IAddon
isCacheUsed
in class AbstractAddon
public boolean isVar()
public boolean isLocalVar()
public boolean isGlobalVar()
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)