Class FeaturesAttribute

    • Constructor Detail

      • FeaturesAttribute

        public FeaturesAttribute()
    • Method Detail

      • createValue

        public FeaturesAttribute.FeaturesAttributeValues createValue​(Template template)
        Description copied from class: ReflectiveAttribute
        Create an instance of a attribute value object. Each instance must be new and unique. Instances must NOT be shared.

        The object will be populated from the json. Each public field will be populated by looking up the value in the json.

        If a field in the object has the HasDefaultValue annotation then no exception will be thrown if the json does not contain a value.

        Fields in the object with the OneOf annotation must have one of the fields in the request data.

        • String
        • Integer
        • Float
        • Double
        • Short
        • Boolean
        • Character
        • Byte
        • Enum
        • PJsonObject
        • URL
        • Any enum
        • PJsonArray
        • any type with a 0 argument constructor
        • array of any of the above (String[], boolean[], PJsonObject[], ...)
        If there is a public "postConstruct"() method then it will be called after the fields are all set.

        In the case where the a parameter type is a normal POJO (not a special case like PJsonObject, URL, enum, double, etc...) then it will be assumed that the json data is a json object and the parameters will be recursively parsed into the new object as if it is also MapLayer parameter object.

        It is important to put values in the value object as public fields because reflection is used when printing client config as well as generating documentation. If a field is intended for the client software as information but is not intended to be set (or sent as part of the request data), the field can be a final field.

        Specified by:
        createValue in class ReflectiveAttribute<FeaturesAttribute.FeaturesAttributeValues>
        Parameters:
        template - the template that this attribute is part of.
      • validate

        public void validate​(java.util.List<java.lang.Throwable> validationErrors,
                             Configuration configuration)
        Description copied from interface: ConfigurationObject
        validate that the configuration was correct.
        Parameters:
        validationErrors - a list to add any detected errors to.
        configuration - the containing configuration