if(null == buf)
return null;
ByteArrayInputStream inBytes = new ByteArrayInputStream(buf);
ObjectInputStream inObject;
CompositeData metadata;
try {
inObject = new ObjectInputStream(inBytes);
metadata = (CompositeData) inObject.readObject();
inObject.close();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
String typename = metadata.getCompositeType().getTypeName();
// target first
if (typename.equals(BlueprintMetadataMBean.BEAN_METADATA))
return new BPBeanMetadata(metadata);