public class QueryParameter extends Object
Modifier and Type | Field and Description |
---|---|
private Item |
itemType |
private String |
name |
private boolean |
permanent |
private Type |
type |
private Object |
value |
Constructor and Description |
---|
QueryParameter(String name)
Create a new empty non-permanent query parameter.
|
QueryParameter(String name,
boolean permanent,
Type type,
Object value)
Create a new query parameter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
Item |
getItemType()
The parameter should be an entity of the given item type.
|
String |
getName()
Get the name of the parameter.
|
Type |
getType()
Get the type of the parameter.
|
Object |
getValue()
Get the value of the parameter.
|
int |
hashCode() |
boolean |
isPermanent()
Check if the parameter is a permanent parameter.
|
void |
setItemType(Item itemType)
Changes the type of the parameter.
|
void |
setType(Type type)
Changes the type of the parameter.
|
void |
setValue(Object value)
Change the value of the parameter.
|
String |
toString() |
void |
validateValue()
Validate the parameter value using the type information if
it has been provided.
|
private final String name
private final boolean permanent
private Type type
private Item itemType
private Object value
public QueryParameter(String name)
name
- The name of the parameterpublic QueryParameter(String name, boolean permanent, Type type, Object value)
name
- The name of the parameterpermanent
- If the parameter should be permanent or not. A
permanent parameter can't change it's valuetype
- The type of valuevalue
- The valuepublic String getName()
public boolean isPermanent()
public Type getType()
public void setType(Type type)
getItemType()
value to null.type
- The new typepublic Object getValue()
public void setValue(Object value)
value
- The new valuepublic Item getItemType()
public void setItemType(Item itemType)
getType()
value to null.itemType
- The new typepublic void validateValue()
Type.isCorrectType(Object)
. If
an item type has been set it is checked that the value is an
instance of the given item type.