1 48 49 package com.caucho.hessian.jmx; 50 51 import com.caucho.hessian.io.AbstractDeserializer; 52 import com.caucho.hessian.io.AbstractHessianInput; 53 54 import javax.management.ObjectInstance ; 55 import javax.management.ObjectName ; 56 import java.io.IOException ; 57 58 61 public class ObjectInstanceDeserializer extends AbstractDeserializer { 62 public Class getType() 63 { 64 return ObjectInstance .class; 65 } 66 67 public Object readMap(AbstractHessianInput in) 68 throws IOException 69 { 70 String className = null; 71 ObjectName objectName = null; 72 73 String initValue = null; 74 75 while (! in.isEnd()) { 76 String key = in.readString(); 77 78 if ("className".equals(key)) 79 className = in.readString(); 80 else if ("name".equals(key)) 81 objectName = (ObjectName ) in.readObject(ObjectName .class); 82 else 83 in.readObject(); 84 } 85 86 in.readMapEnd(); 87 88 try { 89 return new ObjectInstance (objectName, className); 90 } catch (Exception e) { 91 throw new IOException (String.valueOf(e)); 92 } 93 } 94 } 95 | Popular Tags |