EphemeralConst extends Val<T> implements Op<T>, Serializable { public static <T> EphemeralConst<T> of( final String name, final Supplier<T> supplier ) { return new EphemeralConst<>(requireNonNull(name), supplier); } private  EphemeralConst(
		final String name,
		final Lazy<T> value,
		final Supplier<T> supplier
	); private  EphemeralConst(final String name, final Supplier<T> supplier); @Override Op<T> get(); @Override T value(); @Override String toString(); static EphemeralConst<T> of(
		final String name,
		final Supplier<T> supplier
	); static EphemeralConst<T> of(final Supplier<T> supplier);  }
@Test(expectedExceptions = {NotSerializableException.class}) public void notSerialize() throws IOException { final EphemeralConst<Integer> object = EphemeralConst.of( "some name", new Random()::nextInt ); final byte[] data = IO.object.toByteArray(object); Assert.assertEquals(IO.object.fromByteArray(data), object); }
@Test public void serialize() throws IOException { final Random random = new Random(); final EphemeralConst<Integer> object = EphemeralConst.of( "some name", (Supplier<Integer> & Serializable)random::nextInt ); final byte[] data = IO.object.toByteArray(object); Assert.assertEquals(IO.object.fromByteArray(data), object); }