org.ksoap2.serialization
Class NullSoapObject
java.lang.Object
org.ksoap2.serialization.NullSoapObject
public class NullSoapObject
- extends Object
A class that implements only toString()
.
This is useful in the case where you have a SoapObject
representing an optional
property in your SOAP response.
Example:
private String getAge(SoapObject person) {
return person.safeGetProperty("age").toString();
}
- When the person object has an
age
property, the age
will be returned.
-
When the person object does not have an
age
property, SoapObject.safeGetProperty(String)
returns a NullSoapObject, which in turn returns null
for toString()
.
Now it is safe to always try and get the age
property (assuming your downstream
code can handle age
).
Method Summary |
String |
toString()
Overridden specifically to always return null. |
NullSoapObject
public NullSoapObject()
toString
public String toString()
- Overridden specifically to always return null.
See the example in this class's description as to how this can be useful.
- Overrides:
toString
in class Object
- Returns:
null
- See Also:
SoapObject.safeGetProperty(String)
Copyright © 2002-2011. All Rights Reserved.