@PersistantProperties(properties=@PersistantProperty(property="property")) public class MVariablePropertyAccessor extends AbstractReadAccessor implements IReadAccessor.Standalone, IReadWriteAccessor, IAccessorValueHandler
IReadAccessor.Standalone
Modifier and Type | Field and Description |
---|---|
static String |
VARIABLE_PROPERTY_ID |
Constructor and Description |
---|
MVariablePropertyAccessor() |
MVariablePropertyAccessor(IReadAccessor property) |
Modifier and Type | Method and Description |
---|---|
MVariablePropertyAccessor |
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.
|
String |
getImplementationId()
Unique addon implementation ID.
|
String |
getPrefix() |
IReadAccessor |
getProperty() |
String |
getSuffix() |
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 propertyName)
Called for each value of the iterated element.
|
Object |
handleValue(IExecutionContext ctxt,
Object propertyName,
boolean instantiateAll) |
int |
hashCode() |
protected Object |
internalGet(IExecutionContext ctxt)
Specific addon implementation must be here.
|
boolean |
isCacheUsed()
Returns false by default.
|
boolean |
isShouldIterate()
If this iterator is dedicated to iterate over values, then it should be precised.
|
Object |
set(IExecutionContext ctxt,
IReadAccessor accessor)
Sets the value.
|
Object |
set(IExecutionContext ctxt,
Object obj)
Sets the value.
|
void |
setPrefix(String prefix) |
void |
setProperty(IReadAccessor property) |
void |
setSuffix(String suffix) |
void |
toString(OuterWithLevel outer)
Method used to send String representation of the current object to the
OuterWithLevel . |
castToExpected, compileRead, compileRead, compileRead, compileRead, get, getGenericTypes, isConstantValue, isShouldBeWrappedToConstantValue, isShouldNotCache
getInternalCacheIdentifier, isInternalCacheIdentifierNeeded, optimize, resetCachedData, setInternalCacheIdentifier, toString, wasRegistered
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
finalize, getClass, notify, notifyAll, wait, wait, wait
compileRead, compileRead, compileRead, compileRead, get, isConstantValue, isShouldBeWrappedToConstantValue
getGenericTypes
getInternalCacheIdentifier, isInternalCacheIdentifierNeeded, optimize, resetCachedData, setInternalCacheIdentifier, wasRegistered
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
public static final String VARIABLE_PROPERTY_ID
public MVariablePropertyAccessor()
public MVariablePropertyAccessor(IReadAccessor 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.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 propertyName) throws MAccessorException
IAccessorValueHandler
handleValue
in interface IAccessorValueHandler
MAccessorException
public Object handleValue(IExecutionContext ctxt, Object propertyName, 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 boolean isShouldIterate()
IReadAccessor
MRuleInternalRuntimeException
if Exception must be thrown.isShouldIterate
in interface IReadAccessor
public String getImplementationId()
IAddon
getImplementationId
in interface IAddon
public MVariablePropertyAccessor 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 IReadAccessor getProperty()
public final void setProperty(IReadAccessor property)
public boolean isCacheUsed()
AbstractAddon
isCacheUsed
in interface IAddon
isCacheUsed
in class AbstractAddon
public String getPrefix()
public void setPrefix(String prefix)
public String getSuffix()
public void setSuffix(String suffix)