Package com.enragedginger.stephenerialization.annotations

Examples of com.enragedginger.stephenerialization.annotations.Stephenerializable.version()


    final Stephenerializable annotation = clazz.getAnnotation(Stephenerializable.class);
    if (annotation == null) {
      throw new StephenerializationException("The class " + clazz.getName() + " cannot be Stephenerialized "
          + "because it lacks a Stephenerializable annotation.");
    } else {
      final int version = annotation.version();
      final Set<StephenerializableField> fields = getFieldFactory().generateFields(clazz, version);
      try {
        streamer.writeInt(version); // write the version out to the stream
        for (StephenerializableField field : fields) {
          writeField(object, clazz, field.getField(), streamer);
View Full Code Here


    final Stephenerializable annotation = clazz.getAnnotation(Stephenerializable.class);
    if (annotation == null) {
      throw new StephenerializationException("The class " + clazz.getName() + " cannot be Stephenerialized "
          + "because it lacks a Stephenerializable annotation.");
    } else {
      final int version = annotation.version();
      final Set<StephenerializableField> fields = getFieldFactory().generateFields(clazz, version);
      try {
        streamer.writeInt(version); // write the version out to the stream
        for (StephenerializableField field : fields) {
          writeField(object, field.getField(), streamer);
View Full Code Here

  @Test
  public void testReadWrite() throws IOException, ClassNotFoundException {
    Class<?> cyclicAClass = CyclicA.class;
    String className = cyclicAClass.getSimpleName();
    Stephenerializable annotation = cyclicAClass.getAnnotation(Stephenerializable.class);
    String version = String.valueOf(annotation.version());
    ObjectOutputStream output = TestStreamBuilder.createOutputStream(className, version);
    output.writeObject(cyclicA);
    output.close();
    ObjectInputStream input = TestStreamBuilder.createInputStream(className, version);
    CyclicA actualCyclicA = (CyclicA) input.readObject();
View Full Code Here

    final Stephenerializable annotation = clazz.getAnnotation(Stephenerializable.class);
    if (annotation == null) {
      throw new StephenerializationException("The class " + clazz.getName() + " cannot be Stephenerialized "
          + "because it lacks a Stephenerializable annotation.");
    } else {
      final int version = annotation.version();
      final Set<StephenerializableField> fields = getFieldFactory().generateFields(clazz, version);
      try {
        streamer.writeInt(version); // write the version out to the stream
        for (StephenerializableField field : fields) {
          writeField(object, clazz, field.getField(), streamer);
View Full Code Here

   * @throws ClassNotFoundException
   */
  @Test
  public void readWriteCurrentVersion() throws IOException, ClassNotFoundException {
    Stephenerializable annotation = sandwichClass.getAnnotation(Stephenerializable.class);
    String version = String.valueOf(annotation.version());
    ObjectOutputStream output = TestStreamBuilder.createOutputStream(className, version);
    output.writeObject(subSandwich);
    output.close();
    ObjectInputStream input = TestStreamBuilder.createInputStream(className, version);
    SubSandwich actualSandwich = (SubSandwich) input.readObject();
View Full Code Here

   * @throws ClassNotFoundException
   */
  @Test
  public void readWriteCurrentVersion() throws IOException, ClassNotFoundException {
    Stephenerializable annotation = sandwichClass.getAnnotation(Stephenerializable.class);
    String version = String.valueOf(annotation.version());
    ObjectOutputStream output = TestStreamBuilder.createOutputStream(className, version);
    output.writeObject(sandwich);
    output.close();
    ObjectInputStream input = TestStreamBuilder.createInputStream(className, version);
    Sandwich actualSandwich = (Sandwich) input.readObject();
View Full Code Here

    final Stephenerializable annotation = clazz.getAnnotation(Stephenerializable.class);
    if (annotation == null) {
      throw new StephenerializationException("The class " + clazz.getName() + " cannot be Stephenerialized "
          + "because it lacks a Stephenerializable annotation.");
    } else {
      final int version = annotation.version();
      final Set<StephenerializableField> fields = fieldFactory.generateFields(clazz, version);
      streamer.writeInt(version); // write the version out to the stream
      for (StephenerializableField field : fields) {
        try {
          writeField(object, clazz, field.getField(), streamer);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.