Java Code Examples for java.beans.XMLEncoder#setPersistenceDelegate()
The following examples show how to use
java.beans.XMLEncoder#setPersistenceDelegate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test4646747.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { XMLEncoder encoder = new XMLEncoder(System.out); encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate()); // WARNING: This can eat up a lot of memory Object[] obs = new Object[10000]; while (obs != null) { try { obs = new Object[obs.length + obs.length / 3]; } catch (OutOfMemoryError error) { obs = null; } } PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class); if (!(pd instanceof MyPersistenceDelegate)) throw new Error("persistence delegate has been lost"); }
Example 2
Source File: Test4646747.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) { XMLEncoder encoder = new XMLEncoder(System.out); encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate()); // WARNING: This can eat up a lot of memory Object[] obs = new Object[10000]; while (obs != null) { try { obs = new Object[obs.length + obs.length / 3]; } catch (OutOfMemoryError error) { obs = null; } } PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class); if (!(pd instanceof MyPersistenceDelegate)) throw new Error("persistence delegate has been lost"); }
Example 3
Source File: AbstractTest.java From hottub with GNU General Public License v2.0 | 6 votes |
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); }
Example 4
Source File: AbstractTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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); }
Example 5
Source File: Test5023552.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { Container container = (Container) oldInstance; Component component = container.getComponent(); return new Expression(container, component, "create", new Object[] {component}); } }); }
Example 6
Source File: Test4679556.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { C c = (C) oldInstance; return new Expression(c, c.getX(), "createC", new Object[] {}); } }); }
Example 7
Source File: Test5023552.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { Container container = (Container) oldInstance; Component component = container.getComponent(); return new Expression(container, component, "create", new Object[] {component}); } }); }
Example 8
Source File: Test4679556.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { C c = (C) oldInstance; return new Expression(c, c.getX(), "createC", new Object[] {}); } }); }
Example 9
Source File: Test4679556.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { C c = (C) oldInstance; return new Expression(c, c.getX(), "createC", new Object[] {}); } }); }
Example 10
Source File: Test5023550.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override protected void initialize(XMLEncoder encoder) { encoder.setOwner(this.owner); encoder.setPersistenceDelegate(A.class, new ADelegate()); encoder.setPersistenceDelegate(B.class, new BDelegate()); encoder.setPersistenceDelegate(C.class, new CDelegate()); }
Example 11
Source File: Test4936682.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate( OuterClass.InnerClass.class, new DefaultPersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance; OuterClass outer = inner.getOuter(); return new Expression(inner, outer, "getInner", new Object[0]); } } ); }
Example 12
Source File: Test5023552.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { Container container = (Container) oldInstance; Component component = container.getComponent(); return new Expression(container, component, "create", new Object[] {component}); } }); }
Example 13
Source File: Test4936682.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate( OuterClass.InnerClass.class, new DefaultPersistenceDelegate() { protected Expression instantiate(Object oldInstance, Encoder out) { OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance; OuterClass outer = inner.getOuter(); return new Expression(inner, outer, "getInner", new Object[0]); } } ); }
Example 14
Source File: Test8013416.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override protected void initialize(XMLEncoder encoder) { super.initialize(encoder); encoder.setPersistenceDelegate(Public.class, new PublicPersistenceDelegate()); }
Example 15
Source File: Test8013416.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Override protected void initialize(XMLEncoder encoder) { super.initialize(encoder); encoder.setPersistenceDelegate(Public.class, new PublicPersistenceDelegate()); }
Example 16
Source File: Test5023557.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(B.class, new BDelegate()); encoder.setPersistenceDelegate(C.class, new CDelegate()); }
Example 17
Source File: Test8013416.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override protected void initialize(XMLEncoder encoder) { super.initialize(encoder); encoder.setPersistenceDelegate(Public.class, new PublicPersistenceDelegate()); }
Example 18
Source File: Test5023557.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(B.class, new BDelegate()); encoder.setPersistenceDelegate(C.class, new CDelegate()); }
Example 19
Source File: Test5023557.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(B.class, new BDelegate()); encoder.setPersistenceDelegate(C.class, new CDelegate()); }
Example 20
Source File: Test5023557.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override protected void initialize(XMLEncoder encoder) { encoder.setPersistenceDelegate(B.class, new BDelegate()); encoder.setPersistenceDelegate(C.class, new CDelegate()); }