public class MNullIfEmptyAccessor extends AbstractReadSourceAccessor
String
(or CharSequence
) or a Collection
is empty and if so, return null instead.IReadAccessor.Standalone
Modifier and Type | Field and Description |
---|---|
static String |
NULLIFEMPTY_ID |
internalExpectedGenericType, internalExpectedType, source
Constructor and Description |
---|
MNullIfEmptyAccessor() |
MNullIfEmptyAccessor(IReadAccessor source) |
Modifier and Type | Method and Description |
---|---|
<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 |
compileValue(ICompilationContext ctxt,
Class<?> expectedType)
Implementation to handle case when expected result is a single value.
|
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.
|
protected boolean |
parseCollections()
Always false.
|
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 . |
clone, equals, getEstimatedReadCost, getGenericCollectionType, getInternalCacheIdentifier, getSource, getType, handleValue, hashCode, internalGet, isCacheUsed, isConstantValue, isInternalCacheIdentifierNeeded, isShouldIterate, resetCachedData, setInternalCacheIdentifier, setSource, wasRegistered
castToExpected, compileRead, compileRead, compileRead, compileRead, get, isShouldBeWrappedToConstantValue, isShouldNotCache
optimize, toString
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
finalize, getClass, notify, notifyAll, wait, wait, wait
getDebugInfo, getDescription, getName, setDebugInfo, setDescription, setName
public static final String NULLIFEMPTY_ID
public MNullIfEmptyAccessor()
public MNullIfEmptyAccessor(IReadAccessor source)
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
protected boolean parseCollections()
parseCollections
in class AbstractReadSourceAccessor
public Object specificHandleValue(IExecutionContext ctxt, Object value) throws MAccessorException
AbstractReadSourceAccessor
specificHandleValue
in class AbstractReadSourceAccessor
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 String getImplementationId()
IAddon
public void toString(OuterWithLevel outer) throws IOException
Outable
OuterWithLevel
.toString
in interface Outable
toString
in class AbstractReadSourceAccessor
IOException