1 48 49 package com.caucho.hessian.io; 50 51 import java.io.IOException ; 52 53 56 abstract public class ValueDeserializer extends AbstractDeserializer { 57 public Object readMap(AbstractHessianInput in) 58 throws IOException 59 { 60 String initValue = null; 61 62 while (! in.isEnd()) { 63 String key = in.readString(); 64 65 if (key.equals("value")) 66 initValue = in.readString(); 67 else 68 in.readObject(); 69 } 70 71 in.readMapEnd(); 72 73 return create(initValue); 74 } 75 76 public Object readObject(AbstractHessianInput in, String []fieldNames) 77 throws IOException 78 { 79 String initValue = null; 80 81 for (int i = 0; i < fieldNames.length; i++) { 82 if ("value".equals(fieldNames[i])) 83 initValue = in.readString(); 84 else 85 in.readObject(); 86 } 87 88 return create(initValue); 89 } 90 91 abstract Object create(String value) 92 throws IOException ; 93 } 94 | Popular Tags |