Class RestParamData


  • public final class RestParamData
    extends Object
    Represents a single parameter for an endpoint.
    • Constructor Detail

      • RestParamData

        public RestParamData​(org.opencastproject.util.doc.rest.RestParameter restParam)
        Convenient constructor: take a RestParameter annotation and create a RestParamData from it.
        Parameters:
        restParam - the RestParameter annotation type that is to be transformed to RestParamData
      • RestParamData

        public RestParamData​(String name,
                             RestParamData.Type type,
                             String defaultValue,
                             String description,
                             String xmlSchema)
                      throws IllegalArgumentException
        Create a parameter for this endpoint, the thing you are adding it to indicates if required or optional
        Parameters:
        name - the parameter name (this is the parameter itself)
        type - [optional] the type of this parameter
        defaultValue - [optional] the default value which is used if this param is missing
        description - [optional] the description to display with this param
        xmlSchema - [optional] the XML schema to display for this param
        Throws:
        IllegalArgumentException - when name is null or non-alphanumeric
    • Method Detail

      • setAttribute

        public void setAttribute​(String key,
                                 String value)
                          throws IllegalArgumentException
        Attributes are used for adjusting rendering of form elements related to this parameter.
        Parameters:
        key - the attribute key (e.g. size)
        value - the attribute value (e.g. 80)
        Throws:
        IllegalArgumentException - when key is null
      • getAttribute

        public String getAttribute​(String key)
        Get the value indexed by key in attributes.
        Parameters:
        key - the attribute key (e.g. size)
        Returns:
        the value indexed by the key or null if that value does not exists
      • getName

        public String getName()
        Get the name of this parameter.
        Returns:
        name of this parameter
      • getDefaultValue

        public String getDefaultValue()
        Get the default value of this parameter.
        Returns:
        default value of this parameter
      • getEscapedDefaultValue

        public String getEscapedDefaultValue()
        Returns:
        an HTML formatted version of the default value for display
      • getEscapedXmlSchema

        public String getEscapedXmlSchema()
        Returns:
        an HTML formatted version of the xml schema for display
      • getType

        public String getType()
        Get the type of this parameter.
        Returns:
        type of this parameter
      • getDescription

        public String getDescription()
        Get the description of this parameter.
        Returns:
        description of this parameter
      • getAttributes

        public Map<String,​String> getAttributes()
        Get the attributes used for adjusting rendering of form elements related to this parameter.
        Returns:
        the attributes used for adjusting rendering of form elements related to this parameter
      • isRequired

        public boolean isRequired()
        Return whether this parameter is required.
        Returns:
        a boolean indicating whether this parameter is required.
      • isPath

        public boolean isPath()
        Return whether this parameter is a path parameter.
        Returns:
        a boolean indicating whether this parameter is a path parameter.
      • setPath

        public void setPath​(boolean path)
        Set whether this parameter is a path parameter.
        Parameters:
        path - a boolean specifying whether this parameter is a path parameter.
      • setRequired

        public void setRequired​(boolean required)
        Set whether this parameter is required.
        Parameters:
        required - if true then this parameter is require, otherwise it is optional
      • toString

        public String toString()
        Return a string representation of this RestParamData object.
        Overrides:
        toString in class Object
        Returns:
        a string representation of this RestParamData object
      • getXmlSchema

        public String getXmlSchema()
        Returns:
        the xmlSchema
      • setXmlSchema

        public void setXmlSchema​(String xmlSchema)
        Parameters:
        xmlSchema - the xmlSchema to set