Japaki Customizing
Pattern Level
The easiest way to change the string representation of an object is to use
another pattern. Most implementations of java.text.Format
take
a string argument to define their behaviour.
Either
- change the pattern for a single item by specifing the pattern.
- change the default pattern creating a new parser mold.
Steps
For a new default pattern the steps to be taken are
- Create a new parser mold with the new default pattern.
- Add parser mold with a name to parser store.
- Use new name.
Format Level
Sometimes a new format is needed, this is for example the case,
- if no pattern fulfills the specific needs
- for a new base type.
Steps
- Create a new base type, if necessary,
for example
net.sf.japaki.basic.Duration
.
- Create a new format,
for example
net.sf.japaki.text.DurationFormat
.
- Create a new parser mold,
for example
net.sf.japaki.kit.DurationParserMold
.
- Add parser mold with a name to parser store,
for example "duration".
- Use new name.
Parser Level
In rare cases a new parser is required.
Steps
- Create a new parser.
- Create a new parser bean, if necessary.
- Inherit from
net.sf.japaki.SyntaxParser
and add new parser or
create new syntax parser.