public class FieldMapping extends Object
null value, than a field with the same
name as the source field is created for the source.
null
value as mapping would create a 1:1 copy of the source.
TODO: Is it OK to keep an actual implementation in the Service API package?| Modifier and Type | Field and Description |
|---|---|
static char |
COMMENT_CHAR
The '#' char is used for comments
|
| Constructor and Description |
|---|
FieldMapping(Constraint globalFilter)
Creates a FieldMapping that matches all fields but does not map any field.
|
FieldMapping(String fieldPattern,
boolean ignoreField,
String... mappedTo)
Creates a Mapping the maps (
ignore = false)) or ignores (
ignore = true) fields that match the defined pattern. |
FieldMapping(String fieldPattern,
Constraint filter,
String... mappedTo)
Creates an mapping based on the parsed parameter
|
FieldMapping(String fieldPattern,
String... mappedTo)
Creates an 1:1 mapping for all values of fields that confirm the the
defined pattern.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMapping(String mapping)
Adds a mapping
|
boolean |
equals(Object obj) |
String |
getFieldPattern()
The Wildcard Pattern (*,?)
|
Constraint |
getFilter()
The constraint used to filter values of the source field
|
Set<String> |
getMappings()
The target fields values of the source fields are copied to
|
Pattern |
getRegexPattern()
Getter for the RegexPettern representing the parsed wildcard.
|
int |
hashCode() |
boolean |
ignoreField()
Returns
true if fields that match the pattern are ignored. |
boolean |
isGlobal()
Returns
true if this fieldMapping maps any field. |
void |
removeFilter()
Removes any specified filter
|
void |
removeMapping(String mapping)
Removes the mapping from the list.
|
void |
setFilter(Constraint constraint)
Setter for the filter used for values.
|
String |
toString() |
boolean |
usesWildcard()
Returns
true if the fieldPattern uses wildcards (? |
public static final char COMMENT_CHAR
public FieldMapping(Constraint globalFilter) throws IllegalArgumentException
globalFilter - The global filter. Typically a TextConstraint.IllegalArgumentException - if the parsed Filter is nullpublic FieldMapping(String fieldPattern, String... mappedTo) throws IllegalArgumentException
NOTE
null as fieldPattern matches any field, but does
not map anything. This can be used to define global language filters-
fieldPattern - the pattern (typically the names pace followed by an *)mappedTo - the list of target fields (if the mappings contain null
filtered values of the current field in the source Representation
are copied to the same field name in the target Representation.IllegalArgumentException - if null or an empty string is parsed as patternpublic FieldMapping(String fieldPattern, boolean ignoreField, String... mappedTo) throws IllegalArgumentException
ignore = false)) or ignores (
ignore = true) fields that match the defined pattern.fieldPattern - the pattern used to match field namesignoreField - if false (the default) than fields that match
the parsed pattern are processed. If true than fields that
match the pattern are ignored.mappedTo - the list of target fields (if the mappings contain null
filtered values of the current field in the source Representation
are copied to the same field name in the target Representation.IllegalArgumentException - if null or an empty string is parsed as patternpublic FieldMapping(String fieldPattern, Constraint filter, String... mappedTo) throws IllegalArgumentException
fieldPattern - the pattern used to select fields of the source representationfilter - the constraint used to filter values of selected fieldsmappedTo - the list of target fields (if the mappings contain null
filtered values of the current field in the source Representation
are copied to the same field name in the target Representation.IllegalArgumentException - if null or an empty string is parsed as patternpublic final boolean ignoreField()
true if fields that match the pattern are ignored.
This is can only be the case if no Filter is defined (getFilter()
returns null).public final boolean isGlobal()
public final Pattern getRegexPattern()
null if this mapping does not
use wildcards within the field pattern.public final boolean usesWildcard()
true if the fieldPattern uses wildcards (? or *)true if the fieldPattern uses wildcardspublic String getFieldPattern()
public Set<String> getMappings()
public Constraint getFilter()
public void setFilter(Constraint constraint)
null is parsed
the filter is removed.constraint - the constraint or null to deactivate any
filtering.public void removeFilter()
public void addMapping(String mapping)
mapping - the Mapping (use null to configure a 1:1 Mapping)public void removeMapping(String mapping)
null mapping is added to the list to preserve
the default 1:1 mapping.mapping - The mapping to removeCopyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.