Const extends Val<T> implements Serializable { public static <T> Const<T> of(final String name, final T value) { return new Const<>(requireNonNull(name), value); } private  Const(final String name, final T constant); @Override T value(); @Override String toString(); static Const<T> of(final String name, final T value); static Const<T> of(final T value);  }
@Test public void serialize() throws IOException { final Const<Integer> object = Const.of("some name", new Random().nextInt()); final byte[] data = IO.object.toByteArray(object); Assert.assertEquals(IO.object.fromByteArray(data), object); }