Class MapfishParser

java.lang.Object
org.mapfish.print.parser.MapfishParser

public final class MapfishParser extends Object
This class parses json parameter objects into the parameter object taken by MapLayerFactoryPlugin instances and into ReflectiveAttribute value objects

Essentially it maps the keys in the json object to public fields in the object obtained from the MapLayerFactoryPlugin.createParameter() method.

There is a more explicit explanation in ReflectiveAttribute.createValue(org.mapfish.print.config.Template)

See Also:
  • Field Details

  • Method Details

    • parse

      public static void parse(boolean errorOnExtraProperties, PObject requestData, Object objectToPopulate, String... extraPropertyToIgnore)
      Populate the param object by obtaining the values from the like names values in the request data object.
      Parameters:
      errorOnExtraProperties - if true then throw an error when there are properties in the request data that are not in the param. Otherwise log them as a warning.
      requestData - the layer configuration json.
      objectToPopulate - the parameter object that will be passed to the layer factory or is the attribute value.
      extraPropertyToIgnore - An array of properties to ignore in request data. For example Layers do not need "type" but the property has to be there for MapAttribute to be able to choose the correct plugin.
    • parsePrimitive

      public static Object parsePrimitive(String fieldName, PrimitiveAttribute<?> pAtt, PObject requestData)
      Get the value of a primitive type from the request data.
      Parameters:
      fieldName - the name of the attribute to get from the request data.
      pAtt - the primitive attribute.
      requestData - the data to retrieve the value from.
    • stringRepresentation

      public static String stringRepresentation(Class<?> aClass)
      Return a friendly representation of the class for printing the configuration options to a client.
      Parameters:
      aClass - the class to inspect