Class PrimitiveAttribute<VALUE>

java.lang.Object
org.mapfish.print.attribute.PrimitiveAttribute<VALUE>
Type Parameters:
VALUE - The value type of the attribute
All Implemented Interfaces:
Attribute, ConfigurationObject
Direct Known Subclasses:
BooleanAttribute, FloatAttribute, IntegerAttribute, StringArrayAttribute, StringAttribute

public abstract class PrimitiveAttribute<VALUE> extends Object implements Attribute
A type of attribute whose value is a primitive type.
  • Field Details

    • defaultValue

      protected VALUE defaultValue
      The default value.
  • Constructor Details

    • PrimitiveAttribute

      protected PrimitiveAttribute(Class<VALUE> valueClass)
      Constructor.
      Parameters:
      valueClass - the type of the value of this attribute
  • Method Details

    • getValueClass

      public final Class<VALUE> getValueClass()
    • getDefault

      public final VALUE getDefault()
    • setDefault

      public abstract void setDefault(VALUE value)
      A default value for this attribute.
      Parameters:
      value - The default value.
    • setConfigName

      public final void setConfigName(String configName)
      Description copied from interface: Attribute
      Set the name of the attribute as set in the configuration file.
      Specified by:
      setConfigName in interface Attribute
      Parameters:
      configName - the name of the attribute
    • validate

      public void validate(List<Throwable> validationErrors, Configuration configuration)
      Description copied from interface: ConfigurationObject
      validate that the configuration was correct.
      Specified by:
      validate in interface ConfigurationObject
      Parameters:
      validationErrors - a list to add any detected errors to.
      configuration - the containing configuration
    • validateValue

      public void validateValue(Object value)
      Validation of the value from a request.
      Parameters:
      value - The value from a request.
    • printClientConfig

      public final void printClientConfig(org.json.JSONWriter json, Template template) throws org.json.JSONException
      Description copied from interface: Attribute
      Write this attribute out the the json writer so that clients can know what attributes are expected.
      Specified by:
      printClientConfig in interface Attribute
      Parameters:
      json - the json writer to write to
      template - the template that this attribute is part of
      Throws:
      org.json.JSONException
    • clientConfigTypeDescription

      protected String clientConfigTypeDescription()
      Returns a string that is a technical description of the type. In other words, a string that the client software (user of the capabilities response) can use to create a request or UI.
    • getValue

      public Object getValue(@Nonnull Template template, @Nonnull String attributeName, @Nonnull PObject requestJsonAttributes)
      Description copied from interface: Attribute
      Get the attribute value.
      Specified by:
      getValue in interface Attribute
      Parameters:
      template - the template of the current request.
      attributeName - the name of the attribute
      requestJsonAttributes - the json data for populating the attribute values
      Returns:
      the value