/** * {@inheritDoc} This implementation will attempt to create a new constructor if one is not available. */ protected <T> Constructor<T> getNewConstructor(final Class<T> clazz) { return registry.lookup(clazz).getNoInitConstructor(); } }
/** * Get the constructor to use for a class. Returns {@code null} if no suitable constructor is available. * * @param clazz the class to get a constructor for * @return the constructor, or {@code null} if none is available */ protected <T> Constructor<T> getNewConstructor(final Class<T> clazz) { return registry.lookup(clazz).getNoArgConstructor(); }
/** * Invoke the public constructor accepting an ObjectInput. * * @param objectInput the ObjectInput to pass to the constructor * @return the new instance * @throws IOException if an I/O error occurs */ public Object callObjectInputConstructor(final ObjectInput objectInput) throws IOException { final Constructor<?> objectInputConstructor = serMethods.getObjectInputConstructor(); return invokeConstructor(objectInputConstructor, objectInput); }
/** * Construct a new instance. * * @param field the serializable field * @param value the value */ public FloatReadField(final SerializableField field, final float value) { super(field.getName(), false); this.value = value; }
/** * Invoke the no-arg constructor on this class. * * @return the new instance * @throws IOException if an I/O error occurs */ public Object callNoArgConstructor() throws IOException { final Constructor<?> noArgConstructor = serMethods.getNoArgConstructor(); return invokeConstructor(noArgConstructor); }
public SerializableGapClassDescriptor(final SerializableClass serializableClass, final ClassDescriptor superDescriptor) throws ClassNotFoundException { type = serializableClass.getSubjectClass(); this.serializableClass = serializableClass; this.superDescriptor = superDescriptor; }
/** * Invoke the {@code writeObject()} method for an object. * * @param object the object to invoke on * @param outputStream the object output stream to pass in * @throws IOException if an I/O error occurs */ public void callWriteObject(Object object, ObjectOutputStream outputStream) throws IOException { serMethods.callWriteObject(object, outputStream); }
/** * Determine whether this class has a {@code readObject()} method. * * @return {@code true} if there is a {@code readObject()} method */ public boolean hasReadObject() { return serMethods.hasReadObject(); }
/** * Determine whether this class has a {@code readResolve()} method. * * @return {@code true} if there is a {@code readResolve()} method */ public boolean hasReadResolve() { return serMethods.hasReadResolve(); }
/** {@inheritDoc} */ public <T> T create(final Class<T> clazz) throws InvalidClassException { return reflectiveCreator.create(clazz); } }
/** * Determine whether this class has a {@code writeObject()} method. * * @return {@code true} if there is a {@code writeObject()} method */ public boolean hasWriteObject() { return serMethods.hasWriteObject(); }
/** * Invoke the {@code readObject()} method for an object. * * @param object the object to invoke on * @param inputStream the object input stream to pass in * @throws IOException if an I/O error occurs * @throws ClassNotFoundException if a class was not able to be loaded */ public void callReadObject(Object object, ObjectInputStream inputStream) throws IOException, ClassNotFoundException { serMethods.callReadObject(object, inputStream); }
/** * Construct a new instance. * * @param field the serializable field * @param value the value */ public ObjectReadField(final SerializableField field, final Object value) { super(field.getName(), false); this.value = value; }
/** * Construct a new instance. * * @param field the serializable field * @param value the value */ public LongReadField(final SerializableField field, final long value) { super(field.getName(), false); this.value = value; }
/** * Construct a new instance with the default value. * * @param field the serializable field */ public LongReadField(final SerializableField field) { super(field.getName(), true); value = 0; }
/** * Construct a new instance with the default value. * * @param field the serializable field */ public ShortReadField(final SerializableField field) { super(field.getName(), true); value = 0; }
/** * Construct a new instance. * * @param field the serializable field * @param value the value */ public DoubleReadField(final SerializableField field, final double value) { super(field.getName(), false); this.value = value; }
/** * Construct a new instance with the default value. * * @param field the serializable field */ public DoubleReadField(final SerializableField field) { super(field.getName(), true); value = 0; }
/** * Construct a new instance. * * @param field the serializable field * @param value the value */ public IntReadField(final SerializableField field, final int value) { super(field.getName(), false); this.value = value; }
/** * Construct a new instance. * * @param field the serializable field * @param value the value */ public CharReadField(final SerializableField field, final char value) { super(field.getName(), false); this.value = value; }