Class RestParamData
- java.lang.Object
-
- org.opencastproject.runtimeinfo.rest.RestParamData
-
public final class RestParamData extends Object
Represents a single parameter for an endpoint.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRestParamData.Type
-
Constructor Summary
Constructors Constructor Description RestParamData(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(org.opencastproject.util.doc.rest.RestParameter restParam)Convenient constructor: take a RestParameter annotation and create a RestParamData from it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAttribute(String key)Get the value indexed by key in attributes.Map<String,String>getAttributes()Get the attributes used for adjusting rendering of form elements related to this parameter.StringgetDefaultValue()Get the default value of this parameter.StringgetDescription()Get the description of this parameter.StringgetEscapedDefaultValue()StringgetEscapedXmlSchema()StringgetName()Get the name of this parameter.StringgetType()Get the type of this parameter.StringgetXmlSchema()booleanisPath()Return whether this parameter is a path parameter.booleanisRequired()Return 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)StringtoString()Return a string representation of this RestParamData object.
-
-
-
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 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 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.
-
getXmlSchema
public String getXmlSchema()
- Returns:
- the xmlSchema
-
setXmlSchema
public void setXmlSchema(String xmlSchema)
- Parameters:
xmlSchema- the xmlSchema to set
-
-