|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.text.Format org.geotools.referencing.wkt.Preprocessor
A parser that performs string replacements before to delegate the work to an other parser.
String replacements are specified through calls to the addDefinition
method. In the example below, the string in the parseObject call is expanded into the full GEOGCS["WGS84", ...
string before
to be parsed.
addDefinition("WGS84", "GEOGCS[\"WGS84\", DATUM[
...etc...]]
...etc...
parseObject("PROJCS[\"Mercator_1SP\", WGS84, PROJECTION[]]")
Nested Class Summary |
Nested classes inherited from class java.text.Format |
java.text.Format.Field |
Field Summary | |
protected java.text.Format |
parser
The WKT parser, usually a Parser object. |
Constructor Summary | |
Preprocessor(java.text.Format parser)
Creates a new preprocessor that delegates the work to the specified parser. |
Method Summary | |
void |
addDefinition(java.lang.String name,
java.lang.String value)
Adds a predefined Well Know Text (WKT). |
java.lang.StringBuffer |
format(java.lang.Object object,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition position)
Formats the specified object. |
java.util.Set |
getDefinitionNames()
Returns an unmodifiable set which contains all definition's names given to the addDefinition(name, ...) |
java.lang.Object |
parseObject(java.lang.String wkt)
Parses the specified Well Know Text without restriction on the expected type. |
java.lang.Object |
parseObject(java.lang.String text,
java.lang.Class type)
Parses the specified text and ensure that the resulting object is of the specified type. |
java.lang.Object |
parseObject(java.lang.String wkt,
java.text.ParsePosition position)
Parses the specified Well Know Text starting at the specified position. |
void |
printDefinitions(java.io.Writer out)
Prints to the specified stream a table of all definitions. |
void |
removeDefinition(java.lang.String name)
Removes a definition set in some previous call to addDefinition(name, ...) |
Methods inherited from class java.text.Format |
clone, format, formatToCharacterIterator |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.text.Format parser
Parser
object.
Constructor Detail |
public Preprocessor(java.text.Format parser)
parser
- The WKT parser, usually a Parser
object.Method Detail |
public java.lang.StringBuffer format(java.lang.Object object, java.lang.StringBuffer toAppendTo, java.text.FieldPosition position)
object
- The object to format.toAppendTo
- Where the text is to be appended.position
- Identification of a field in the formatted text.
public java.lang.Object parseObject(java.lang.String wkt, java.text.ParsePosition position)
parseObject
(wkt.substring(position.getIndex()))
.
wkt
- The text to parse.position
- The index of the first character to parse.
public java.lang.Object parseObject(java.lang.String wkt) throws java.text.ParseException
parseObject
(wkt, Object.class)
.
wkt
- The text to parse.
java.text.ParseException
- if the text can't be parsed.public java.lang.Object parseObject(java.lang.String text, java.lang.Class type) throws java.text.ParseException, org.opengis.referencing.FactoryException
addDefinition(name, ...)
.parser
.
text
- The text, as a name, a WKT to parse, or an authority code.type
- The expected type for the object to be parsed (usually a
CoordinateReferenceSystem.class
or
MathTransform.class
).
java.text.ParseException
- if parsing the specified WKT failed.
org.opengis.referencing.FactoryException
- if the object is not of the expected type.public void addDefinition(java.lang.String name, java.lang.String value) throws java.text.ParseException
name
- The name for the definition to be added.value
- The Well Know Text (WKT) represented by the name.
java.lang.IllegalArgumentException
- if the name is invalid.
java.text.ParseException
- if the WKT can't be parsed.public void removeDefinition(java.lang.String name)
addDefinition(name, ...)
.
name
- The name of the definition to remove.public java.util.Set getDefinitionNames()
addDefinition(name, ...)
method. The
elements in this set are sorted in alphabetical order.
public void printDefinitions(java.io.Writer out) throws java.io.IOException
addDefinition(java.lang.String, java.lang.String)
method.
out
- writer The output stream where to write the table.
java.io.IOException
- if an error occured while writting to the output stream.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |