use of java.beans.DefaultPersistenceDelegate in project jdk8u_jdk by JetBrains.
the class AbstractTest method test.
static void test(AbstractTest object) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
XMLEncoder encoder = new XMLEncoder(output);
encoder.setPersistenceDelegate(object.getClass(), new DefaultPersistenceDelegate(new String[] { "value" }));
encoder.writeObject(object);
encoder.close();
System.out.print(output);
ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
XMLDecoder decoder = new XMLDecoder(input);
AbstractTest result = (AbstractTest) decoder.readObject();
decoder.close();
if (object.getValue() != result.getValue())
throw new Error("Should be " + object);
}
use of java.beans.DefaultPersistenceDelegate in project jdk8u_jdk by JetBrains.
the class Test4968523 method main.
public static void main(String[] args) {
String[] names = { "time" };
test(Date.class, new DefaultPersistenceDelegate(names));
test(null, new DefaultPersistenceDelegate());
}
Aggregations