Class FieldMapping
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.core.FoundationObject
com.northconcepts.datapipeline.foundations.datamapping.DataMappingObject
com.northconcepts.datapipeline.foundations.datamapping.DataMappingPart
com.northconcepts.datapipeline.foundations.datamapping.AbstractFieldMapping
com.northconcepts.datapipeline.foundations.datamapping.FieldMapping
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,DataMappingProblemsSupplier,IFieldMapping,Serializable
A field mapping that sets one target field to the result of an expression evaluated in a
DataMappingExpressionContext.- See Also:
-
Field Summary
Fields inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
internalId, internalName, log, TIMESTAMP_FORMATFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this object's current state to aDataException.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element fieldMappingElement) Returns the data mapping containing this part (itself for aDataMapping) or null if it is not known.Returns the data mapping part containing this one or null if there is none.Returns the kind of part this is, such asDataMappingPartType.FieldMapping.voidgetDataMappingProblems(List<DataMappingProblem> problems, boolean includeChildren) Adds this element's problems to the list, plus those of its children whenincludeChildrenis true; the default adds none.Expressionprotected ObjectmapFieldImpl(ExpressionContext expressionContext, DataMappingResult result) Computes the target field's value in the mapping context; called only when there is no condition or it is true.setCondition(LogicalExpression condition) Sets the condition for computing the field's value; when it is false the field gets the default value or null.setDefaultValueExpression(Expression defaultValueExpression) Sets the expression that supplies the field's value when the mapped value is null or the condition is false.setSourceExpression(Expression sourceExpression) setTargetFieldName(String targetFieldName) toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class com.northconcepts.datapipeline.foundations.datamapping.AbstractFieldMapping
getCondition, getConditionAsString, getDataMappingPartName, getDefaultValueExpression, getDefaultValueExpressionAsString, getTargetFieldName, getType, mapField, setType, validateNameMethods inherited from class com.northconcepts.datapipeline.foundations.datamapping.DataMappingPart
getDataMappingName, getDataMappingPartContainerName, getDataMappingPartContainerTypeMethods inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
assertValid, assertValid, clone, exception, exception, exception, getInternalId, getInternalName, resetInternalIdMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionPropertiesMethods inherited from interface com.northconcepts.datapipeline.foundations.datamapping.DataMappingProblemsSupplier
getDataMappingProblems, getDataMappingProblems
-
Constructor Details
-
FieldMapping
public FieldMapping() -
FieldMapping
-
-
Method Details
-
getDataMappingProblems
Description copied from interface:DataMappingProblemsSupplierAdds this element's problems to the list, plus those of its children whenincludeChildrenis true; the default adds none.- Specified by:
getDataMappingProblemsin interfaceDataMappingProblemsSupplier- Overrides:
getDataMappingProblemsin classAbstractFieldMapping
-
setCondition
Description copied from class:AbstractFieldMappingSets the condition for computing the field's value; when it is false the field gets the default value or null.- Overrides:
setConditionin classAbstractFieldMapping
-
setDefaultValueExpression
Description copied from class:AbstractFieldMappingSets the expression that supplies the field's value when the mapped value is null or the condition is false.- Overrides:
setDefaultValueExpressionin classAbstractFieldMapping
-
setTargetFieldName
- Overrides:
setTargetFieldNamein classAbstractFieldMapping
-
getSourceExpression
public Expression getSourceExpression() -
setSourceExpression
-
getSourceExpressionAsString
-
mapFieldImpl
Description copied from class:AbstractFieldMappingComputes the target field's value in the mapping context; called only when there is no condition or it is true. A null result falls back to the default value expression.- Specified by:
mapFieldImplin classAbstractFieldMapping
-
getDataMapping
Description copied from class:DataMappingPartReturns the data mapping containing this part (itself for aDataMapping) or null if it is not known.- Specified by:
getDataMappingin classDataMappingPart
-
getDataMappingPartContainer
Description copied from class:DataMappingPartReturns the data mapping part containing this one or null if there is none.- Specified by:
getDataMappingPartContainerin classDataMappingPart
-
getDataMappingPartType
Description copied from class:DataMappingPartReturns the kind of part this is, such asDataMappingPartType.FieldMapping.- Specified by:
getDataMappingPartTypein classDataMappingPart
-
addExceptionProperties
Description copied from class:FoundationObjectAdds this object's current state to aDataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.- Specified by:
addExceptionPropertiesin interfaceDataExceptionContributor- Overrides:
addExceptionPropertiesin classAbstractFieldMapping
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classAbstractFieldMapping
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classAbstractFieldMapping- Parameters:
source-- Returns:
- this instance.
-
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException.- Specified by:
toXmlElementin interfaceXmlSerializable- Overrides:
toXmlElementin classAbstractFieldMapping
-
fromXmlElement
- Specified by:
fromXmlElementin interfaceXmlSerializable- Overrides:
fromXmlElementin classAbstractFieldMapping
-