}
public static <T> T unembed(
Class<T> clazz, String embeddingFieldName, List<Attribute> attrs){
if(clazz.isArray() || Collection.class.isAssignableFrom(clazz)){
throw new SienaException("can't serializer Array/Collection in native mode");
}
T obj = Util.createObjectInstance(clazz);
try {
Attribute theAttr;
for (Field f : ClassInfo.getClassInfo(clazz).updateFields) {
if(!ClassInfo.isEmbeddedNative(f)){
// doesn't try to analyze fields, just try to store it
String attrName = getEmbeddedAttributeName(embeddingFieldName, f);
theAttr = null;
// searches attribute and if found, removes it from the list to reduce number of attributes
for(Attribute attr: attrs){
if(attrName.equals(attr.getName())){
theAttr = attr;
attrs.remove(attr);
break;
}
}
if(theAttr != null){
SdbMappingUtils.setFromString(obj, f, theAttr.getValue());
}
} else {
Object value = SdbNativeSerializer.unembed(
f.getType(), getEmbeddedAttributeName(embeddingFieldName, f),
attrs);
Util.setField(obj, f, value);
}
}
return obj;
}catch(Exception e){
throw new SienaException(e);
}
}