Class RestParamData
java.lang.Object
org.opencastproject.runtimeinfo.rest.RestParamData
Represents a single parameter for an endpoint.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionRestParamData(String name, RestParamData.Type type, String defaultValue, String description, String xmlSchema) Create a parameter for this endpoint, the thing you are adding it to indicates if required or optionalRestParamData(RestParameter restParam) Convenient constructor: take a RestParameter annotation and create a RestParamData from it. -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String key) Get the value indexed by key in attributes.Get the attributes used for adjusting rendering of form elements related to this parameter.Get the default value of this parameter.Get the description of this parameter.getName()Get the name of this parameter.getType()Get the type of this parameter.booleanisPath()Return whether this parameter is a path parameter.booleanReturn whether this parameter is required.voidsetAttribute(String key, String value) Attributes are used for adjusting rendering of form elements related to this parameter.voidsetPath(boolean path) Set whether this parameter is a path parameter.voidsetRequired(boolean required) Set whether this parameter is required.voidsetXmlSchema(String xmlSchema) toString()Return a string representation of this RestParamData object.
-
Constructor Details
-
RestParamData
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 parameterdefaultValue- [optional] the default value which is used if this param is missingdescription- [optional] the description to display with this paramxmlSchema- [optional] the XML schema to display for this param- Throws:
IllegalArgumentException- when name is null or non-alphanumeric
-
-
Method Details
-
setAttribute
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
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
Get the name of this parameter.- Returns:
- name of this parameter
-
getDefaultValue
Get the default value of this parameter.- Returns:
- default value of this parameter
-
getEscapedDefaultValue
- Returns:
- an HTML formatted version of the default value for display
-
getEscapedXmlSchema
- Returns:
- an HTML formatted version of the xml schema for display
-
getType
Get the type of this parameter.- Returns:
- type of this parameter
-
getDescription
Get the description of this parameter.- Returns:
- description of this parameter
-
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
Return a string representation of this RestParamData object. -
getXmlSchema
- Returns:
- the xmlSchema
-
setXmlSchema
- Parameters:
xmlSchema- the xmlSchema to set
-