本文整理汇总了Java中org.ksoap2.serialization.SoapObject.hasProperty方法的典型用法代码示例。如果您正苦于以下问题:Java SoapObject.hasProperty方法的具体用法?Java SoapObject.hasProperty怎么用?Java SoapObject.hasProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.ksoap2.serialization.SoapObject
的用法示例。
在下文中一共展示了SoapObject.hasProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FromProperties
import org.ksoap2.serialization.SoapObject; //导入方法依赖的package包/类
@Override
public void FromProperties(SoapObject so) {
Comment = ReadNullableString(so, "Comment");
VirtualPath = ReadNullableString(so, "VirtualPath");
URLFullImage = ReadNullableString(so, "URLFullImage");
ThumbnailFile = ReadNullableString(so, "ThumbnailFile");
Width = Integer.parseInt(so.getProperty("Width").toString());
Height = Integer.parseInt(so.getProperty("Height").toString());
WidthThumbnail = Integer.parseInt(so.getProperty("WidthThumbnail").toString());
HeightThumbnail = Integer.parseInt(so.getProperty("HeightThumbnail").toString());
if (so.hasProperty("Location")) {
SoapObject location = (SoapObject) so.getProperty("Location");
Location = new LatLong();
Location.FromProperties(location);
}
if (so.hasProperty("ImageType"))
ImageType = ImageFileType.valueOf(so.getProperty("ImageType").toString());
}
示例2: FromProperties
import org.ksoap2.serialization.SoapObject; //导入方法依赖的package包/类
public void FromProperties(SoapObject so) {
Description = so.getProperty("Description").toString();
Value = Double.parseDouble(so.getProperty("Value").toString());
// Optional strings come through as "anyType" if they're not actually present, so check for that.
Object o = so.getProperty("SubDescription");
if (o != null && !o.toString().contains("anyType"))
SubDescription = o.toString();
NumericType = NumType.valueOf(so.getProperty("NumericType").toString());
if (so.hasProperty("Query")) {
SoapObject q = (SoapObject) so.getProperty("Query");
Query = new FlightQuery();
Query.FromProperties(q);
}
}
示例3: parseObject
import org.ksoap2.serialization.SoapObject; //导入方法依赖的package包/类
private static void parseObject(SoapObject in, Object out) throws IllegalAccessException, InstantiationException {
for(Field field : out.getClass().getDeclaredFields()){
field.setAccessible(true);
String fieldName = field.getName();
// Ignore fields that doesn't exist in SoapObject
if ( ! in.hasProperty(fieldName) ) continue;
Object valueToParse = in.getProperty(fieldName);
Class fieldClass = field.getType();
// If the type of field is Object, primitive or immutable, assign it directly
if ( canBeAssignedDirectly(fieldClass) ){
field.set(out, getPrimitiveValue(fieldClass, valueToParse));
}
else if ( isCollection(fieldClass) ) {
fieldClass = getSpecificCollectionClass(field);
Collection c = (Collection) fieldClass.newInstance();
parse((SoapObject) valueToParse,c);
field.set(out, c);
}
else if ( isMap(fieldClass) ) {
fieldClass = getSpecificMapClass(field);
Map map = (Map) fieldClass.newInstance();
parse((SoapObject) valueToParse,map);
field.set(out, map);
}
else{
Object fieldObject = fieldClass.newInstance();
parse((SoapObject) valueToParse,fieldObject);
field.set(out, fieldObject);
}
}
}