@PersistantProperty(property="source") @PersistantProperty(property="values",alias="value") @PersistantProperty(property="property") @PersistantProperty(property="condition") @PersistantProperty(property="decimals") public abstract class MArithmeticAccessor extends AbstractReadAccessor
Modifier and Type | Class and Description |
---|---|
protected class |
MArithmeticAccessor.InternalIterator
Class allowing to internally iterate on property.
|
IReadAccessor.Standalone
Constructor and Description |
---|
MArithmeticAccessor() |
MArithmeticAccessor(IReadAccessor... sources) |
MArithmeticAccessor(IReadAccessor source) |
MArithmeticAccessor(List<IReadAccessor> sources) |
MArithmeticAccessor(Rounder decimals) |
MArithmeticAccessor(Rounder decimals,
IReadAccessor... sources) |
MArithmeticAccessor(Rounder decimals,
IReadAccessor source) |
MArithmeticAccessor(Rounder decimals,
List<IReadAccessor> sources) |
Modifier and Type | Method and Description |
---|---|
MArithmeticAccessor |
clone()
Clones the Addon.
|
<G,C extends Collection<G>> |
compileCollection(ICompilationContext ctxt,
Class<C> expectedType,
Class<G> expectedGenericType)
Unsupported.
|
void |
compileValue(ICompilationContext ctxt,
Class<?> expectedType)
Implementation to handle case when expected result is a single value.
|
boolean |
equals(Object o) |
protected abstract BigDecimal |
evaluate(IExecutionContext ctxt,
MArithmeticAccessor.InternalIterator valuesToEvaluate)
Performs the arithmetic operation.
|
protected BigDecimal |
format(BigDecimal ret)
Method used to format returned property (desired number of decimals, trailing zeros removed, etc ...)
|
ICondition |
getCondition() |
Rounder |
getDecimals() |
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<?> |
getInternalExpectedType()
Returns expected types to provide for sub-accessors compilation.
|
int |
getMaxDecimals() |
IReadAccessor |
getProperty() |
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.
|
List<IReadAccessor> |
getValues() |
int |
hashCode() |
protected Object |
internalGet(IExecutionContext ctxt)
Performs operations like rounding, casting and delegates the pure arithmetic operation to
evaluate(IExecutionContext, InternalIterator) |
boolean |
isCacheUsed()
Returns false by default.
|
boolean |
isShouldIterate()
If this iterator is dedicated to iterate over values, then it should be precised.
|
void |
setCondition(ICondition condition) |
void |
setDecimals(Rounder decimals) |
void |
setProperty(IReadAccessor value) |
void |
setSource(IReadAccessor source) |
void |
setValues(List<IReadAccessor> sources) |
protected boolean |
shouldFormatResult()
If the implementation of
evaluate(IExecutionContext, InternalIterator) performs the rounding and formating operations,
then this method should be overridden to return false. |
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
getImplementationId, getInternalCacheIdentifier, isInternalCacheIdentifierNeeded, optimize, resetCachedData, setInternalCacheIdentifier, wasRegistered
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
public MArithmeticAccessor()
public MArithmeticAccessor(IReadAccessor source)
public MArithmeticAccessor(List<IReadAccessor> sources)
public MArithmeticAccessor(IReadAccessor... sources)
public MArithmeticAccessor(Rounder decimals)
public MArithmeticAccessor(Rounder decimals, IReadAccessor source)
public MArithmeticAccessor(Rounder decimals, List<IReadAccessor> sources)
public MArithmeticAccessor(Rounder decimals, IReadAccessor... sources)
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
compileCollection
in class AbstractReadAccessor
MRuleValidationException
public CostInfo getEstimatedReadCost(ICompilationContext ctxt) throws MRuleValidationException
IReadAccessor
ctxt
- Compilation context.MRuleValidationException
- if validation problem detected.protected Object internalGet(IExecutionContext ctxt) throws MAccessorException
evaluate(IExecutionContext, InternalIterator)
internalGet
in class AbstractReadAccessor
MAccessorException
protected abstract BigDecimal evaluate(IExecutionContext ctxt, MArithmeticAccessor.InternalIterator valuesToEvaluate) throws MAccessorException
MAccessorException
protected boolean shouldFormatResult()
evaluate(IExecutionContext, InternalIterator)
performs the rounding and formating operations,
then this method should be overridden to return false.protected final BigDecimal format(BigDecimal ret)
public Class<?> getInternalExpectedType()
BigDecimal
for basic implementation if "property" is null, null otherwise.public Class<?> getType(IContext ctxt) throws MAccessorException
IAccessor
MAccessorException
public Class<?> getGenericCollectionType(IContext ctxt) throws MAccessorException
IAccessor
MAccessorException
public boolean isShouldIterate()
IReadAccessor
MRuleInternalRuntimeException
if Exception must be thrown.public MArithmeticAccessor 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
.IOException
public boolean isCacheUsed()
AbstractAddon
isCacheUsed
in interface IAddon
isCacheUsed
in class AbstractAddon
public IReadAccessor getSource()
public void setSource(IReadAccessor source)
public List<IReadAccessor> getValues()
public void setValues(List<IReadAccessor> sources)
public IReadAccessor getProperty()
public void setProperty(IReadAccessor value)
public ICondition getCondition()
public void setCondition(ICondition condition)
public Rounder getDecimals()
public int getMaxDecimals()
public void setDecimals(Rounder decimals)