public class RequestProperty extends Object
This class is intended to allow to define meta data about a used web service (e.g. within an Enumeration)
| Modifier | Constructor and Description |
|---|---|
protected |
RequestProperty(String name,
boolean required,
String defaultValue,
String... valueList)
Constructs a Property definition for a (RESTful) web service.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowedValue(String value) |
String |
defaultValue() |
boolean |
encode(StringBuilder requestString,
boolean first,
Collection<String> values)
Encodes the Property for the given parameters.
|
String |
getName() |
Set<String> |
getValueList() |
boolean |
hasDefault() |
boolean |
hasValueList() |
boolean |
isOptional() |
boolean |
isRequired() |
String |
toString() |
protected RequestProperty(String name, boolean required, String defaultValue, String... valueList)
name - the name of the property (MUST NOT be null)required - defines if the property is optional or requireddefaultValue - the value used if this parameter is not parsed.
null indicates no default configuration.valueList - the list of allowed values for this parameter.
null or an empty array indicate that there are no
restrictions on possible values.public String getName()
public boolean hasDefault()
public String defaultValue()
public boolean hasValueList()
public boolean allowedValue(String value)
public boolean isRequired()
public boolean isOptional()
public boolean encode(StringBuilder requestString, boolean first, Collection<String> values)
requestString - The string builder used to create the requestfirst - if the property is the first property added to the requestvalues - the value(s) for the property. If null or an empty list, than the
defaultValue() is added if present. Also if the parsed collection contains the
null value the defaultValue() is added instead.true if the parsed request string was modified as a result of this call -
meaning that parameter was added to the request.Copyright © 2010–2016 The Apache Software Foundation. All rights reserved.