Class PropertyBuilder


  • public class PropertyBuilder
    extends java.lang.Object
    A builder for Property objects
    • Method Detail

      • builder

        public static PropertyBuilder builder​(Property orig)
        Return a new instance preconfigured with a previously defined Property
        Parameters:
        orig - original property
        Returns:
        this builder
      • booleanType

        public PropertyBuilder booleanType​(java.lang.String name)
        Return a new PropertyBuilder of type Property.Type.Boolean
        Parameters:
        name - name
        Returns:
        this builder
      • longType

        public PropertyBuilder longType​(java.lang.String name)
        Return a new PropertyBuilder of type Property.Type.Long
        Parameters:
        name - name
        Returns:
        this builder
      • name

        public PropertyBuilder name​(java.lang.String name)
        Set the name (identifier)
        Parameters:
        name - name
        Returns:
        this builder
      • title

        public PropertyBuilder title​(java.lang.String title)
        Set the title (display name)
        Parameters:
        title - title
        Returns:
        this builder
      • description

        public PropertyBuilder description​(java.lang.String description)
        Set the description
        Parameters:
        description - description
        Returns:
        this builder
      • required

        public PropertyBuilder required​(boolean required)
        Set required
        Parameters:
        required - true if required
        Returns:
        this builder
      • blankIfUnexpandable

        public PropertyBuilder blankIfUnexpandable​(boolean blankIfUnexpandable)
        Set blankIfUnexpandable
        Parameters:
        blankIfUnexpandable - true if unexpanded variables get replaced with blanks
        Returns:
        this builder
      • defaultValue

        public PropertyBuilder defaultValue​(java.lang.String value)
        Set the default value
        Parameters:
        value - value
        Returns:
        this builder
      • values

        public PropertyBuilder values​(java.util.List<java.lang.String> values)
        Set the select values
        Parameters:
        values - values
        Returns:
        this builder
      • labels

        public PropertyBuilder labels​(java.util.Map<java.lang.String,​java.lang.String> labels)
        Set the select labels
        Parameters:
        labels - map of value to label
        Returns:
        this builder
      • values

        public PropertyBuilder values​(java.lang.String... values)
        Set the select values
        Parameters:
        values - values
        Returns:
        this builder
      • validator

        public PropertyBuilder validator​(PropertyValidator validator)
        Set the property validator, only applies to String, Integer, Long, and FreeSelect types
        Parameters:
        validator - validator
        Returns:
        this builder
      • renderingOptions

        public PropertyBuilder renderingOptions​(java.util.Map<java.lang.String,​java.lang.Object> renderingOptions)
        Adds all rendering options from the given renderingOptions
        Parameters:
        renderingOptions - options
        Returns:
        this builder
        See Also:
        StringRenderingConstants
      • dynamicValues

        public PropertyBuilder dynamicValues​(boolean dynamicValues)
      • renderingOption

        public PropertyBuilder renderingOption​(java.lang.String optionKey,
                                               java.lang.Object optionValue)
        Adds the given renderingOption
        Parameters:
        optionKey - key
        optionValue - value
        Returns:
        this builder
        See Also:
        StringRenderingConstants
      • renderingAsTextarea

        public PropertyBuilder renderingAsTextarea()
        Set the string property to display as a Multi-line Text area.
        Returns:
        this builder
        Throws:
        java.lang.IllegalStateException - if the property type is not Property.Type.String
      • renderingAsPassword

        public PropertyBuilder renderingAsPassword()
        Set the string property to display as a Password.
        Returns:
        this builder
        Throws:
        java.lang.IllegalStateException - if the property type is not Property.Type.String
      • build

        public Property build()
        Build the Property object
        Returns:
        built property
        Throws:
        java.lang.IllegalStateException - if type or name is not set
      • getType

        public Property.Type getType()
        Returns:
        the type already defined for the builder