java.beans.DefaultPersistenceDelegate源码实例Demo

类java.beans.DefaultPersistenceDelegate源码实例Demo

下面列出了java.beans.DefaultPersistenceDelegate 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: AbstractTest.java
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);
}
 
源代码2 项目: TencentKona-8   文件: AbstractTest.java
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);
}
 
源代码3 项目: jdk8u60   文件: AbstractTest.java
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);
}
 
源代码4 项目: openjdk-jdk8u   文件: AbstractTest.java
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);
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: AbstractTest.java
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);
}
 
源代码6 项目: openjdk-jdk9   文件: AbstractTest.java
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);
}
 
源代码7 项目: jdk8u-jdk   文件: AbstractTest.java
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);
}
 
源代码8 项目: hottub   文件: AbstractTest.java
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);
}
 
源代码9 项目: openjdk-8-source   文件: AbstractTest.java
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);
}
 
源代码10 项目: openjdk-8   文件: AbstractTest.java
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);
}
 
源代码11 项目: jdk8u_jdk   文件: AbstractTest.java
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);
}
 
源代码12 项目: jdk8u-jdk   文件: AbstractTest.java
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);
}
 
源代码13 项目: jdk8u-dev-jdk   文件: AbstractTest.java
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);
}
 
源代码14 项目: dragonwell8_jdk   文件: TestPersistenceDelegate.java
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);
}
 
源代码15 项目: dragonwell8_jdk   文件: Test4936682.java
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]);
                }
            }
    );
}
 
源代码16 项目: dragonwell8_jdk   文件: Test4679556.java
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[] {});
        }
    });
}
 
源代码17 项目: TencentKona-8   文件: TestPersistenceDelegate.java
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);
}
 
源代码18 项目: TencentKona-8   文件: Test4936682.java
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]);
                }
            }
    );
}
 
源代码19 项目: TencentKona-8   文件: Test4679556.java
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[] {});
        }
    });
}
 
源代码20 项目: jdk8u60   文件: TestPersistenceDelegate.java
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);
}
 
源代码21 项目: jdk8u60   文件: Test4936682.java
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]);
                }
            }
    );
}
 
源代码22 项目: jdk8u60   文件: Test4679556.java
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[] {});
        }
    });
}
 
源代码23 项目: openjdk-jdk8u   文件: TestPersistenceDelegate.java
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);
}
 
源代码24 项目: openjdk-jdk8u   文件: Test4936682.java
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]);
                }
            }
    );
}
 
源代码25 项目: openjdk-jdk8u   文件: Test4679556.java
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[] {});
        }
    });
}
 
源代码26 项目: netbeans   文件: WebServicePersistenceManager.java
public void saveDescriptor(WebServiceDescriptor descriptor) throws IOException {
    XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(descriptor.getXmlDescriptor())));
    encoder.setExceptionListener(this);
    DefaultPersistenceDelegate delegate = new WebServiceDataPersistenceDelegate();
    encoder.setPersistenceDelegate(WSService.class, delegate);
    encoder.writeObject(descriptor);

    encoder.flush();
    encoder.close();
}
 
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);
}
 
源代码28 项目: openjdk-jdk8u-backup   文件: Test4936682.java
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]);
                }
            }
    );
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: Test4679556.java
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[] {});
        }
    });
}
 
源代码30 项目: openjdk-jdk9   文件: TestPersistenceDelegate.java
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);
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 类所在包
 类方法
 同包方法