public class Preprocessor extends Format
addDefinition method. In
 the example below, the WGS84 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[]]")
Format.Field| Modifier and Type | Field and Description | 
|---|---|
| protected Format | parserThe WKT parser, usually a  Parserobject. | 
| Constructor and Description | 
|---|
| Preprocessor(Format parser)Creates a new preprocessor that delegates the work to the specified parser. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addDefinition(String name,
             String value)Adds a predefined Well Know Text (WKT). | 
| StringBuffer | format(Object object,
      StringBuffer toAppendTo,
      FieldPosition position)Formats the specified object. | 
| Set | getDefinitionNames()Returns an unmodifiable set which contains all definition's names given to the  
 addDefinition(name, ...) | 
| Object | parseObject(String wkt)Parses the specified Well Know Text without restriction on the expected type. | 
| Object | parseObject(String text,
           Class type)Parses the specified text and ensure that the resulting object is of the specified type. | 
| Object | parseObject(String wkt,
           ParsePosition position)Parses the specified Well Know Text starting at the specified position. | 
| void | printDefinitions(Writer out)Prints to the specified stream a table of all definitions. | 
| void | removeDefinition(String name)Removes a definition set in some previous call to  
 addDefinition(name, ...) | 
clone, format, formatToCharacterIteratorpublic StringBuffer format(Object object, StringBuffer toAppendTo, FieldPosition position)
public Object parseObject(String wkt, ParsePosition position)
 parseObject(wkt.substring(position.getIndex())).parseObject in class Formatwkt - The text to parse.position - The index of the first character to parse.null in case of failure.public Object parseObject(String wkt) throws ParseException
 parseObject(wkt, Object.class).parseObject in class Formatwkt - The text to parse.ParseException - if the text can't be parsed.public Object parseObject(String text, Class type) throws ParseException, FactoryException
       addDefinition(name, ...).
   addDefinition. This text is given to the underlying parser.
   EPSG:6326.
 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).ParseException - if parsing the specified WKT failed.FactoryException - if the object is not of the expected type.public void addDefinition(String name, String value) throws ParseException
value argument given to this method can
 contains itself other definitions specified in some previous calls to this method.name - The name for the definition to be added.value - The Well Know Text (WKT) represented by the name.IllegalArgumentException - if the name is invalid.ParseException - if the WKT can't be parsed.public void removeDefinition(String name)
 addDefinition(name, ...).name - The name of the definition to remove.public Set getDefinitionNames()
 addDefinition(name, ...) method. The elements in this set
 are sorted in alphabetical order.public void printDefinitions(Writer out) throws IOException
addDefinition(java.lang.String, java.lang.String) method.out - writer The output stream where to write the table.IOException - if an error occured while writting to the output stream.Copyright © 1996–2019 Geotools. All rights reserved.