Class Deserializer
java.lang.Object
cz.metacentrum.perun.rpc.deserializer.Deserializer
- Direct Known Subclasses:
- JsonDeserializer,- UrlDeserializer
Subclasses of 
Deserializer class provide methods to deserialize values supplied as name/value pairs in some
 form (ie. in JSON or as HTTP request parameters). It is presumed that the names of the values are unique - results
 are undefined if multiple values with the same name are supplied. Implementing any of the read* methods is optional.- Author:
- Jan Klos invalid input: '<'ddd@mail.muni.cz>, Pavel Zlamal invalid input: '<'256627@mail.muni.cz>
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract booleanReturnstrueif value with the specified name is supplied.jakarta.servlet.http.HttpServletRequestReturn HttpServletRequest related to concrete call this deserializer is used to process.<T> TReads value from root Json node.<T> TReads value with the specified name asvalueType.abstract StringreadAll()Returns string representation of the variables stored in the deserializer.int[]readArrayOfInts(String name) abstract BooleanreadBoolean(String name) Reads value with the specified name asBoolean.abstract intReads value with the specified name asint.<T> List<T> Reads array from root Json node.<T> List<T> Reads array with the specified name asList<valueType>.readListPerunBeans(String name) Reads array with the specified name asList<PerunBean>.readLocalDate(String name) Reads LocalDate value with the specified name.readPerunBean(String name) Reads value with the specified name asPerunBean.abstract StringreadString(String name) Reads value with the specified name asString.abstract UUIDReads value with the specified name asUUID.voidCheck whether method that changes state is not GET.
- 
Constructor Details- 
Deserializerpublic Deserializer()
 
- 
- 
Method Details- 
containsReturnstrueif value with the specified name is supplied.- Parameters:
- name- name of the value to check
- Returns:
- trueif value with the specified name is supplied,- falseotherwise
 
- 
getServletRequestpublic jakarta.servlet.http.HttpServletRequest getServletRequest()Return HttpServletRequest related to concrete call this deserializer is used to process.Note that this "request" is not necessarily used as source to read parameters by other methods of deserializer. It IS typically for GET requests, but NOT for POST with JSON/JSONP data format. - Returns:
- HttpServletRequest related to concrete call
- Throws:
- UnsupportedOperationException- if this deserializer does not implement this method
 
- 
readReads value with the specified name asvalueType.- Parameters:
- name- name of the value to read
- valueType- type of the value to read
- Returns:
- the value as valueType
- Throws:
- UnsupportedOperationException- if this deserializer does not implement this method
- RpcException- if the specified value cannot be parsed as- valueTypeor if it is not supplied
 
- 
readReads value from root Json node.- Parameters:
- valueType- type of the value to read
- Returns:
- the value as valueType
- Throws:
- UnsupportedOperationException- if this deserializer does not implement this method
- RpcException- if the specified value cannot be parsed as- valueTypeor if it is not supplied
 
- 
readAllReturns string representation of the variables stored in the deserializer.- Returns:
- string containing all variables
- Throws:
- RpcException
 
- 
readArrayOfInts
- 
readBooleanReads value with the specified name asBoolean.- Parameters:
- name- name of the value to read
- Returns:
- the value as Boolean
- Throws:
- RpcException- If the specified value cannot be parsed as- Stringor if it is not supplied
 
- 
readIntReads value with the specified name asint.- Parameters:
- name- name of the value to read
- Returns:
- the value as int
- Throws:
- RpcException- if the specified value cannot be parsed as- intor if it is not supplied
 
- 
readListReads array with the specified name asList<valueType>.- Parameters:
- name- name of the array to read
- valueType- type of the value to read
- Returns:
- the value as List<valueType>
- Throws:
- UnsupportedOperationException- if this deserializer does not implement this method
- RpcException- if the specified value cannot be parsed as- valueTypeor if it is not supplied
 
- 
readListReads array from root Json node.- Parameters:
- valueType- type of the value to read
- Returns:
- the value as List<valueType>
- Throws:
- UnsupportedOperationException- if this deserializer does not implement this method
- RpcException- if the specified value cannot be parsed as- valueTypeor if it is not supplied
 
- 
readListPerunBeansReads array with the specified name asList<PerunBean>.- Parameters:
- name- name of the array to read
- Returns:
- the value as List<PerunBean>
- Throws:
- UnsupportedOperationException- if this deserializer does not implement this method
- RpcException- if the specified value cannot be parsed as- perunBeanor if it is not supplied
 
- 
readLocalDateReads LocalDate value with the specified name. Expected ISO-8601 format. (yyyy-MM-dd)- Parameters:
- name- name of the localDate value
- Returns:
- parsed local date
 
- 
readPerunBeanReads value with the specified name asPerunBean.- Parameters:
- name- name of the value to read
- Returns:
- the value as PerunBean
- Throws:
- UnsupportedOperationException- if this deserializer does not implement this method
- RpcException- if the specified value cannot be parsed as- perunBeanor if it is not supplied
 
- 
readStringReads value with the specified name asString.- Parameters:
- name- name of the value to read
- Returns:
- the value as String
- Throws:
- RpcException- If the specified value cannot be parsed as- Stringor if it is not supplied
 
- 
readUUIDReads value with the specified name asUUID.- Parameters:
- name- name of the value to read
- Returns:
- the value as UUID
- Throws:
- RpcException- If the specified value cannot be parsed as- UUIDor if it is not supplied
 
- 
stateChangingCheckpublic void stateChangingCheck()Check whether method that changes state is not GET.- Throws:
- RpcException- if method is GET
 
 
-