java.beans.DefaultPersistenceDelegate Java Examples

The following examples show how to use java.beans.DefaultPersistenceDelegate. 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: AbstractTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 #2
Source File: AbstractTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 #3
Source File: AbstractTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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: AbstractTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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 #6
Source File: AbstractTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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 #7
Source File: AbstractTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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 #8
Source File: AbstractTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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 #9
Source File: AbstractTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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 #10
Source File: AbstractTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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 #11
Source File: AbstractTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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 #12
Source File: AbstractTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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 #13
Source File: AbstractTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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 #14
Source File: Test4679556.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 #15
Source File: Test4936682.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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 #16
Source File: Test4936682.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 #17
Source File: TestPersistenceDelegate.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    Class<?> type = TestPersistenceDelegate.class;
    test(type, DefaultPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, new BeanPersistenceDelegate());
    test(type, BeanPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, null);
    test(type, DefaultPersistenceDelegate.class);
    // the following tests fails on previous build
    test(Bean.class, BeanPersistenceDelegate.class);
    test(BeanPersistenceDelegate.class, BeanPersistenceDelegate.class);
}
 
Example #18
Source File: Test4679556.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 #19
Source File: Test4936682.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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 #20
Source File: TestPersistenceDelegate.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    Class<?> type = TestPersistenceDelegate.class;
    test(type, DefaultPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, new BeanPersistenceDelegate());
    test(type, BeanPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, null);
    test(type, DefaultPersistenceDelegate.class);
    // the following tests fails on previous build
    test(Bean.class, BeanPersistenceDelegate.class);
    test(BeanPersistenceDelegate.class, BeanPersistenceDelegate.class);
}
 
Example #21
Source File: Test4936682.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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 #22
Source File: Test4679556.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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 #23
Source File: TestPersistenceDelegate.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    Class<?> type = TestPersistenceDelegate.class;
    test(type, DefaultPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, new BeanPersistenceDelegate());
    test(type, BeanPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, null);
    test(type, DefaultPersistenceDelegate.class);
    // the following tests fails on previous build
    test(Bean.class, BeanPersistenceDelegate.class);
    test(BeanPersistenceDelegate.class, BeanPersistenceDelegate.class);
}
 
Example #24
Source File: Test4679556.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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 #25
Source File: Test4936682.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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 #26
Source File: TestPersistenceDelegate.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    Class<?> type = TestPersistenceDelegate.class;
    test(type, DefaultPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, new BeanPersistenceDelegate());
    test(type, BeanPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, null);
    test(type, DefaultPersistenceDelegate.class);
    // the following tests fails on previous build
    test(Bean.class, BeanPersistenceDelegate.class);
    test(BeanPersistenceDelegate.class, BeanPersistenceDelegate.class);
}
 
Example #27
Source File: Test4679556.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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 #28
Source File: Test4936682.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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 #29
Source File: TestPersistenceDelegate.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws InterruptedException {
    Class<?> type = TestPersistenceDelegate.class;
    test(type, DefaultPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, new BeanPersistenceDelegate());
    test(type, BeanPersistenceDelegate.class);
    ENCODER.setPersistenceDelegate(type, null);
    test(type, DefaultPersistenceDelegate.class);
    // the following tests fails on previous build
    test(Bean.class, BeanPersistenceDelegate.class);
    test(BeanPersistenceDelegate.class, BeanPersistenceDelegate.class);
}
 
Example #30
Source File: Test4679556.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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[] {});
        }
    });
}