public class Mapping
extends java.lang.Object
implements java.lang.Comparable
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
static java.lang.String |
STR_TYPE_CONTAINS |
static java.lang.String |
STR_TYPE_EQUALS
The constants that define the possible types of mappings in a human-friendly format.
|
static java.lang.String |
STR_TYPE_REGULAR_EXPRESSION |
static int |
TYPE_CONTAINS |
static int |
TYPE_EQUALS
The constants that define the possible types of mappings.
|
static int |
TYPE_REGULAR_EXPRESSION |
Constructor and Description |
---|
Mapping()
Creates a blank object.
|
Mapping(int mappingID,
java.lang.String toValue,
java.lang.String fromValue,
int mappingType,
boolean isCaseSensitive,
int sequence)
Creates a mapping for all fields.
|
Mapping(java.lang.String toValue)
Creates a mapping using the given "to" value.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(java.lang.Object mapping)
So we can be sorted.
|
protected void |
delete()
Causes the mapping to be deleted from the database.
|
void |
dumpToLog()
Dumps the mapping to the log.
|
boolean |
equals(java.lang.Object obj)
Overriding equals...
|
java.lang.String |
getFromValue()
Gets the "From" value.
|
static java.lang.String |
getHumanFriendlyMappingType(int mappingType)
Gets a human-friendly representation of a mapping type.
|
int |
getID()
Gets the database ID of the mapping.
|
boolean |
getIsCaseSensitive()
Indicates whether or not the match is case sensitive.
|
int |
getMappingSetID()
Gets the database ID of the set containing this
mapping.
|
int |
getMappingType()
Gets the type of the value, as defined by one of the
"TYPE" constants defined in this class.
|
static int |
getMappingTypeForHumanFriendlyMapingType(java.lang.String strMappingType)
Maps a human-friendly representation of a mapping type
to one of the int constants in this class.
|
int |
getSequence()
Gets the sequence of the mapping in the set.
|
java.lang.String |
getToValue()
Gets the "to" value.
|
java.lang.String |
getToValueWithBackReferencesReplaced(java.lang.String value)
Returns a "to value" with any back-references replaced,
if the "to value" contains any.
|
boolean |
mapValue(java.lang.String value)
Indicates whether or not the given value
matches, according to the specified criteria.
|
protected void |
save()
Saves the mapping to the database.
|
void |
setFromValue(java.lang.String fromValue)
Sets the "From" value.
|
void |
setIsCaseSensitive(boolean isCaseSensitive)
Determines whether or not the match is case sensitive.
|
protected void |
setMappingSetID(int mappingSetID)
Gets the database ID of the set containing this
mapping.
|
void |
setMappingType(int mappingType)
Gets the type of the value, as defined by one of the
"TYPE" constants defined in this class.
|
void |
setSequence(int sequence)
Sets the sequence of the mapping in the set.
|
void |
setToValue(java.lang.String toValue)
Sets the "to" value.
|
public static org.apache.log4j.Logger log
public static final int TYPE_EQUALS
public static final int TYPE_CONTAINS
public static final int TYPE_REGULAR_EXPRESSION
public static final java.lang.String STR_TYPE_EQUALS
public static final java.lang.String STR_TYPE_CONTAINS
public static final java.lang.String STR_TYPE_REGULAR_EXPRESSION
public Mapping()
public Mapping(java.lang.String toValue)
toValue
- The "to" value.public Mapping(int mappingID, java.lang.String toValue, java.lang.String fromValue, int mappingType, boolean isCaseSensitive, int sequence)
mappingID
- The database ID of the mapping.toValue
- The "to" value.fromValue
- The "from" value.mappingType
- The type.isCaseSensitive
- Indicates whether or not the match
should be case sensitive.sequence
- The sequence.public int getID()
public int getMappingSetID()
protected void setMappingSetID(int mappingSetID)
mappingSetID
- The database ID.@Nullable public java.lang.String getFromValue()
public void setFromValue(java.lang.String fromValue)
fromValue
- The "From" value.@Nullable public java.lang.String getToValue()
public void setToValue(java.lang.String toValue)
toValue
- The "To" value.public int getMappingType()
public void setMappingType(int mappingType)
mappingType
- The type.public boolean getIsCaseSensitive()
public void setIsCaseSensitive(boolean isCaseSensitive)
isCaseSensitive
- A boolean.public int getSequence()
public void setSequence(int sequence)
sequence
- The sequence.public boolean mapValue(@Nullable java.lang.String value)
value
- The value to be mapped.public java.lang.String getToValueWithBackReferencesReplaced(@NotNull java.lang.String value)
value
- The value we're matching against.public int compareTo(java.lang.Object mapping)
compareTo
in interface java.lang.Comparable
mapping
- The Mapping
we're comparing to.public static java.lang.String getHumanFriendlyMappingType(int mappingType)
mappingType
- The type of the mapping, as defined
by one of the constants in this class.public static int getMappingTypeForHumanFriendlyMapingType(java.lang.String strMappingType)
strMappingType
- A string mapping type.protected void delete()
protected void save()
public boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare to.public void dumpToLog()