CharacterCaseTransformer
Changes the character case.
Notes
Modifies the character case of matching fields and values by caseType using one of the following:
UPPERLOWERWORDSWORDSFULLYSENTENCESSENTENCESFULLYSTRINGSTRINGFULLYSWAP
The applyTo property specifies the target for the change, defaulting to VALUE:
VALUEFIELDBOTH
Parser Handler Compatibility
This functionality can be applied as either a pre-parse or post-parse handler.
Examples
The following example first convert a title to lower case except for the first character.
- YAML
- JSON
- XML
handler:
class: CharacterCaseTransformer
applyTo: FIELD
caseType: LOWER
fieldMatcher:
pattern: title
{
"handler": {
"class": "CharacterCaseTransformer",
"applyTo": "FIELD",
"caseType": "LOWER",
"fieldMatcher": {
"pattern": "title"
}
}
}
<handler>
<class>CharacterCaseTransformer</class>
<applyTo>FIELD</applyTo>
<caseType>LOWER</caseType>
<fieldMatcher>
<pattern>title</pattern>
</fieldMatcher>
</handler>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: CharacterCaseTransformer
applyTo: string
caseType: string
fieldMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
label: string
{
"class": "CharacterCaseTransformer",
"applyTo": "string",
"caseType": "string",
"fieldMatcher": {
"ignoreCase": false,
"ignoreDiacritic": false,
"matchEmpty": false,
"method": "BASIC",
"negateMatches": false,
"partial": false,
"pattern": "string",
"replaceAll": false,
"trim": false
},
"label": "string"
}
<handler>
<class>CharacterCaseTransformer</class>
<applyTo>string</applyTo>
<caseType>string</caseType>
<fieldMatcher>
<ignoreCase>false</ignoreCase>
<ignoreDiacritic>false</ignoreDiacritic>
<matchEmpty>false</matchEmpty>
<method>BASIC</method>
<negateMatches>false</negateMatches>
<partial>false</partial>
<pattern>string</pattern>
<replaceAll>false</replaceAll>
<trim>false</trim>
</fieldMatcher>
<label>string</label>
</handler>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
applyTo | string | No | - |
caseType | string | No | - |
fieldMatcher | TextMatcher | No | TextMatcher |
label | string | No | - |
Property Details
applyTo
The default behavior can be adjusted as follows:
- VALUE: Changes are applied only to the field values.
- Example: Field Name:
"Title", Field Value:"hello world"→ Field Value becomes"HELLO WORLD"
- Example: Field Name:
- FIELD: Changes are applied only to the field name.
- Example: Field Name:
"title", Field Value:"hello world"→ Field Name becomes"TITLE"
- Example: Field Name:
- BOTH: Changes are applied to both the field name and its values.
- Example: Field Name:
"title", Field Value:"hello world"→ Field Name becomes"TITLE", Field Value becomes"HELLO WORLD"
- Example: Field Name:
caseType
Transforms the character case of matching fields and values using one of these methods:
- UPPER: Converts all characters to upper case.
- Example:
"hello world"→"HELLO WORLD"
- Example:
- LOWER: Converts all characters to lower case.
- Example:
"HELLO WORLD"→"hello world"
- Example:
- WORDS: Capitalizes the first letter of each word, leaving other
characters unchanged.
- Example:
"hello WORLD"→"Hello WORLD"
- Example:
- WORDSFULLY: Capitalizes the first letter of each word and converts
all other characters to lower case.
- Example:
"hello WORLD"→"Hello World"
- Example:
- SENTENCES: Capitalizes the first letter of each sentence, leaving
other characters unchanged.
- Example:
"hello world. HOW are you?"→"Hello world. HOW are you?"
- Example:
- SENTENCESFULLY: Capitalizes the first letter of each sentence and
converts all other characters to lower case.
- Example:
"hello world. HOW are you?"→"Hello world. How are you?"
- Example:
- STRING: Capitalizes the first letter of the entire string, leaving
other characters unchanged.
- Example:
"hello WORLD"→"Hello WORLD"
- Example:
- STRINGFULLY: Capitalizes the first letter of the entire string and
converts all other characters to lower case.
- Example:
"hello WORLD"→"Hello world"
- Example:
- SWAP: Swaps the case of all characters, converting upper case to
lower case and vice versa.
- Example:
"Hello World"→"hELLO wORLD"
- Example:
fieldMatcher
Matches document fields based on specified patterns and methods
label
An optional, user-supplied label for this step in the importer pipeline. It has no effect on processing — it exists purely to help identify this step, for example in large configurations or in the visual configurator.