Class SimpleDerivedAttributeLoader<T,D>
Object
AbstractAttributeLoader<T>
AbstractDerivedAttributeLoader<T>
SimpleDerivedAttributeLoader<T,D>
- All Implemented Interfaces:
AttributeLoader<T>
,DerivedAttributeLoader<T>
- Direct Known Subclasses:
UniDerivedAttributeLoaderBuilder.BuiltDerivedLoader
-
Field Summary
FieldsFields inherited from class AbstractAttributeLoader
mySpec
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SimpleDerivedAttributeLoader
(AttributeSpec<T> spec, AttributeSpec<? extends D> dependency) protected
SimpleDerivedAttributeLoader
(AttributeSpec<T> spec, AttributeSpec<? extends D> dependency, boolean yield) -
Method Summary
Modifier and TypeMethodDescriptionfinal Set<AttributeSpec<?>>
Returns attributes that need to be loaded prior to calling this loader's loading function.protected abstract T
getValue
(D value, DerivedAttributeContext context) static <T> AttributeLoader<T>
idLoader
(AttributeSpec<T> spec, AttributeSpec<T> dependency) loadValue
(DerivedAttributeContext context) Performs the loading.Methods inherited from class AbstractAttributeLoader
getAttributeSpec, toString
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface AttributeLoader
getAttributeSpec, getCachingStrategy, getContextDependencies, getGlobalTrail
-
Field Details
-
myDependency
-
-
Constructor Details
-
SimpleDerivedAttributeLoader
protected SimpleDerivedAttributeLoader(AttributeSpec<T> spec, AttributeSpec<? extends D> dependency) -
SimpleDerivedAttributeLoader
protected SimpleDerivedAttributeLoader(AttributeSpec<T> spec, AttributeSpec<? extends D> dependency, boolean yield) - Parameters:
spec
-dependency
-yield
- if true, then error and null values will be returned as null, thus allowing other loaders to provide other values for the attribute; if false, this method will always return something
-
-
Method Details
-
getAttributeDependencies
Description copied from interface:AttributeLoader
Returns attributes that need to be loaded prior to calling this loader's loading function.
The returned value must be the same throughout the lifetime of the object.
- Returns:
- the set of attribute dependencies, or
null
if there are none - See Also:
-
loadValue
Description copied from interface:DerivedAttributeLoader
Performs the loading.
If the value is missing or empty, the loader should return
AttributeValue.undefined()
. If for some reason this loader is not applicable for the given row, it should returnnull
.- Parameters:
context
- loading context- Returns:
- the calculated value
-
getValue
- Parameters:
value
-context
-- Returns:
- null if the result should be undefined (or yielded to other loaders)
-
idLoader
-