@SuppressWarnings("unchecked") public <T> T newInstance(Class<T> cls) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException { ClassDescriptor desc = descriptorCache.get(cls); if (desc != null) return (T)desc.newInstance(); try { Constructor<T> constructor = cls.getConstructor(); return constructor.newInstance(); } catch (NoSuchMethodException e) { return (T)instanceFactory.newInstantiator(cls).newInstance(); } }
@SuppressWarnings("unchecked") public <T> T newInstance(Class<T> cls) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException { ClassDescriptor desc = descriptorCache.get(cls); if (desc != null) return (T)desc.newInstance(); try { Constructor<T> constructor = cls.getConstructor(); return constructor.newInstance(); } catch (NoSuchMethodException e) { return (T)instanceFactory.newInstantiator(cls).newInstance(); } }
@SuppressWarnings("unchecked") public <T> T newInstance(Class<T> cls) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException { ClassDescriptor desc = descriptorCache.get(cls); if (desc != null) return (T)desc.newInstance(); try { Constructor<T> constructor = cls.getConstructor(); return constructor.newInstance(); } catch (NoSuchMethodException e) { return (T)instanceFactory.newInstantiator(cls).newInstance(); } }
@Override public Object decode(InputContext ctx, int parameterizedJmfType) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { int indexOrLength = IntegerUtil.decodeInteger(ctx, (parameterizedJmfType >>> INDEX_OR_LENGTH_BYTE_COUNT_OFFSET) & 0x03); if ((parameterizedJmfType & 0x80) != 0) return ctx.getObject(indexOrLength); String className = ctx.getAlias(ClassNameUtil.decodeClassName(ctx)); ClassDescriptor desc = ctx.getClassDescriptor(className); Class<?> cls = desc.getCls(); if (!Serializable.class.isAssignableFrom(cls)) throw new NotSerializableException(cls.getName()); @SuppressWarnings("unchecked") Collection<Object> v = (Collection<Object>)desc.newInstance(); ctx.addToObjects(v); for (int index = 0; index < indexOrLength; index++) v.add(ctx.readObject()); return v; }
@Override public Object decode(InputContext ctx, int parameterizedJmfType) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { int indexOrLength = IntegerUtil.decodeInteger(ctx, (parameterizedJmfType >>> INDEX_OR_LENGTH_BYTE_COUNT_OFFSET) & 0x03); if ((parameterizedJmfType & 0x80) != 0) return ctx.getObject(indexOrLength); String className = ctx.getAlias(ClassNameUtil.decodeClassName(ctx)); ClassDescriptor desc = ctx.getClassDescriptor(className); Class<?> cls = desc.getCls(); if (!Serializable.class.isAssignableFrom(cls)) throw new NotSerializableException(cls.getName()); @SuppressWarnings("unchecked") Collection<Object> v = (Collection<Object>)desc.newInstance(); ctx.addToObjects(v); for (int index = 0; index < indexOrLength; index++) v.add(ctx.readObject()); return v; }
@Override public Object decode(InputContext ctx, int parameterizedJmfType) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { int indexOrLength = IntegerUtil.decodeInteger(ctx, (parameterizedJmfType >>> INDEX_OR_LENGTH_BYTE_COUNT_OFFSET) & 0x03); if ((parameterizedJmfType & 0x80) != 0) return ctx.getObject(indexOrLength); String className = ctx.getAlias(ClassNameUtil.decodeClassName(ctx)); ClassDescriptor desc = ctx.getClassDescriptor(className); Class<?> cls = desc.getCls(); if (!Serializable.class.isAssignableFrom(cls)) throw new NotSerializableException(cls.getName()); @SuppressWarnings("unchecked") Collection<Object> v = (Collection<Object>)desc.newInstance(); ctx.addToObjects(v); for (int index = 0; index < indexOrLength; index++) v.add(ctx.readObject()); return v; }
@Override public Object decode(InputContext ctx, int parameterizedJmfType) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { int indexOrLength = IntegerUtil.decodeInteger(ctx, (parameterizedJmfType >>> INDEX_OR_LENGTH_BYTE_COUNT_OFFSET) & 0x03); if ((parameterizedJmfType & 0x80) != 0) return ctx.getObject(indexOrLength); String className = ClassNameUtil.decodeClassName(ctx); className = ctx.getAlias(className); ClassDescriptor desc = ctx.getClassDescriptor(className); Class<?> cls = desc.getCls(); if (!Serializable.class.isAssignableFrom(cls)) throw new NotSerializableException(cls.getName()); @SuppressWarnings("unchecked") Map<Object, Object> v = (Map<Object, Object>)desc.newInstance(); ctx.addToObjects(v); for (int index = 0; index < indexOrLength; index++) { Object key = ctx.readObject(); Object value = ctx.readObject(); v.put(key, value); } return v; }
@Override public Object decode(InputContext ctx, int parameterizedJmfType) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { int indexOrLength = IntegerUtil.decodeInteger(ctx, (parameterizedJmfType >>> INDEX_OR_LENGTH_BYTE_COUNT_OFFSET) & 0x03); if ((parameterizedJmfType & 0x80) != 0) return ctx.getObject(indexOrLength); String className = ClassNameUtil.decodeClassName(ctx); className = ctx.getAlias(className); ClassDescriptor desc = ctx.getClassDescriptor(className); Class<?> cls = desc.getCls(); if (!Serializable.class.isAssignableFrom(cls)) throw new NotSerializableException(cls.getName()); @SuppressWarnings("unchecked") Map<Object, Object> v = (Map<Object, Object>)desc.newInstance(); ctx.addToObjects(v); for (int index = 0; index < indexOrLength; index++) { Object key = ctx.readObject(); Object value = ctx.readObject(); v.put(key, value); } return v; }
@Override public Object decode(InputContext ctx, int parameterizedJmfType) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { int indexOrLength = IntegerUtil.decodeInteger(ctx, (parameterizedJmfType >>> INDEX_OR_LENGTH_BYTE_COUNT_OFFSET) & 0x03); if ((parameterizedJmfType & 0x80) != 0) return ctx.getObject(indexOrLength); String className = ClassNameUtil.decodeClassName(ctx); className = ctx.getAlias(className); ClassDescriptor desc = ctx.getClassDescriptor(className); Class<?> cls = desc.getCls(); if (!Serializable.class.isAssignableFrom(cls)) throw new NotSerializableException(cls.getName()); @SuppressWarnings("unchecked") Map<Object, Object> v = (Map<Object, Object>)desc.newInstance(); ctx.addToObjects(v); for (int index = 0; index < indexOrLength; index++) { Object key = ctx.readObject(); Object value = ctx.readObject(); v.put(key, value); } return v; }
throw new NotSerializableException(cls.getName()); v = desc.newInstance();
throw new NotSerializableException(cls.getName()); v = desc.newInstance();
throw new NotSerializableException(cls.getName()); v = desc.newInstance();