private Object create(String value) throws IOException { if (value == null) throw new IOException(_cl.getName() + " expects name."); try { return _constructor.newInstance(new Object[]{value}); } catch (Exception e) { throw new IOExceptionWrapper(e); } } }
private Object create(String name) throws IOException { if (name == null) throw new IOException(_enumType.getName() + " expects name."); try { return _valueOf.invoke(null, _enumType, name); } catch (Exception e) { throw new IOExceptionWrapper(e); } } }
private Object create(long initValue) throws IOException { if (initValue == Long.MIN_VALUE) throw new IOException(_cl.getName() + " expects name."); try { return _constructor.newInstance(new Object[]{new Long(initValue)}); } catch (Exception e) { throw new IOExceptionWrapper(e); } } }
Object create(String name) throws IOException { if (name == null) throw new IOException("Serialized Class expects name."); Class cl = _primClasses.get(name); if (cl != null) return cl; try { if (_loader != null) return Class.forName(name, false, _loader); else return Class.forName(name); } catch (Exception e) { throw new IOExceptionWrapper(e); } } }
private Map createMap() throws IOException { if (_type == null) return new HashMap(); else if (_type.equals(Map.class)) return new HashMap(); else if (_type.equals(SortedMap.class)) return new TreeMap(); else { try { return (Map) _ctor.newInstance(); } catch (Exception e) { throw new IOExceptionWrapper(e); } } } }
void serialize(AbstractHessianOutput out, Object obj, Field field) throws IOException { Object value = null; try { value = field.get(obj); } catch (IllegalAccessException e) { log.log(Level.FINE, e.toString(), e); } try { out.writeObject(value); } catch (RuntimeException e) { throw new RuntimeException(e.getMessage() + "\n Java field: " + field, e); } catch (IOException e) { throw new IOExceptionWrapper(e.getMessage() + "\n Java field: " + field, e); } } }
list = (Collection) _type.newInstance(); } catch (Exception e) { throw new IOExceptionWrapper(e);
@Override public Object readMap(AbstractHessianInput in) throws IOException { try { Object obj = instantiate(); return readMap(in, obj); } catch (IOException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IOExceptionWrapper(_type.getName() + ":" + e.getMessage(), e); } }
@Override public Object readObject(AbstractHessianInput in, String[] fieldNames) throws IOException { try { Object obj = instantiate(); return readObject(in, obj, fieldNames); } catch (IOException e) { throw e; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IOExceptionWrapper(_type.getName() + ":" + e.getMessage(), e); } }
@Override public Object readMap(AbstractHessianInput in) throws IOException { try { Object obj = instantiate(); return readMap(in, obj); } catch (IOException e) { throw e; } catch (Exception e) { throw new IOExceptionWrapper(e); } }
/** * support generic type of map, fix the type of short serialization <p> * eg: Map<String, Short> serialize & deserialize * */ @Override public Object readMap(AbstractHessianInput in, Class<?> expectKeyType, Class<?> expectValueType) throws IOException { Map map; if (_type == null) map = new HashMap(); else if (_type.equals(Map.class)) map = new HashMap(); else if (_type.equals(SortedMap.class)) map = new TreeMap(); else { try { map = (Map) _ctor.newInstance(); } catch (Exception e) { throw new IOExceptionWrapper(e); } } in.addRef(map); doReadMap(in, map, expectKeyType, expectValueType); in.readEnd(); return map; }
throw new IOExceptionWrapper(e);
public Object readObject(AbstractHessianInput in, Object obj, String[] fieldNames) throws IOException { try { int ref = in.addRef(obj); for (int i = 0; i < fieldNames.length; i++) { String name = fieldNames[i]; FieldDeserializer deser = (FieldDeserializer) _fieldMap.get(name); if (deser != null) deser.deserialize(in, obj); else in.readObject(); } Object resolve = resolve(obj); if (obj != resolve) in.setRef(ref, resolve); return resolve; } catch (IOException e) { throw e; } catch (Exception e) { throw new IOExceptionWrapper(obj.getClass().getName() + ":" + e, e); } }
throw e; } catch (Exception e) { throw new IOExceptionWrapper(e);
public Object readMap(AbstractHessianInput in, Object obj) throws IOException { try { int ref = in.addRef(obj); while (!in.isEnd()) { Object key = in.readObject(); Method method = (Method) _methodMap.get(key); if (method != null) { Object value = in.readObject(method.getParameterTypes()[0]); method.invoke(obj, new Object[]{value}); } else { Object value = in.readObject(); } } in.readMapEnd(); Object resolve = resolve(obj); if (obj != resolve) in.setRef(ref, resolve); return resolve; } catch (IOException e) { throw e; } catch (Exception e) { throw new IOExceptionWrapper(e); } }
public Object readMap(AbstractHessianInput in, Object obj) throws IOException { try { int ref = in.addRef(obj); while (!in.isEnd()) { Object key = in.readObject(); FieldDeserializer deser = (FieldDeserializer) _fieldMap.get(key); if (deser != null) deser.deserialize(in, obj); else in.readObject(); } in.readMapEnd(); Object resolve = resolve(obj); if (obj != resolve) in.setRef(ref, resolve); return resolve; } catch (IOException e) { throw e; } catch (Exception e) { throw new IOExceptionWrapper(e); } }
private Object create(String value) throws IOException { if (value == null) throw new IOException(_cl.getName() + " expects name."); try { return _constructor.newInstance(new Object[] { value }); } catch (Exception e) { throw new IOExceptionWrapper(e); } } }
private Object create(String name) throws IOException { if (name == null) throw new IOException(_enumType.getName() + " expects name."); try { return _valueOf.invoke(null, _enumType, name); } catch (Exception e) { throw new IOExceptionWrapper(e); } } }
private Object create(long initValue) throws IOException { if (initValue == Long.MIN_VALUE) throw new IOException(_cl.getName() + " expects name."); try { return _constructor.newInstance(new Object[]{new Long(initValue)}); } catch (Exception e) { throw new IOExceptionWrapper(e); } } }
@Override public Object readMap(AbstractHessianInput in) throws IOException { try { Object obj = instantiate(); return readMap(in, obj); } catch (IOException e) { throw e; } catch (Exception e) { throw new IOExceptionWrapper(e); } }