java.beans.Encoder源码实例Demo

类java.beans.Encoder源码实例Demo

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

源代码1 项目: 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]);
                }
            }
    );
}
 
源代码2 项目: openjdk-jdk9   文件: Test4968523.java

private static void test(Class<?> type, PersistenceDelegate pd) {
    Encoder encoder1 = new Encoder();
    Encoder encoder2 = new XMLEncoder(System.out);

    PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
    PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);

    encoder1.setPersistenceDelegate(type, pd);

    if (pd1 == encoder1.getPersistenceDelegate(type))
        throw new Error("first persistence delegate is not changed");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
源代码3 项目: openjdk-jdk9   文件: Test8013416.java

@Override
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
    super.initialize(type, oldInstance, newInstance, out);

    Public<String, String> map = (Public) oldInstance;
    for (Entry<String, String> entry : map.getAll()) {
        String[] args = {entry.getKey(), entry.getValue()};
        out.writeStatement(new Statement(oldInstance, "put", args));
    }
}
 
源代码4 项目: dragonwell8_jdk   文件: Test4968523.java

private static void test(Class<?> type, PersistenceDelegate pd) {
    Encoder encoder1 = new Encoder();
    Encoder encoder2 = new XMLEncoder(System.out);

    PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
    PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);

    encoder1.setPersistenceDelegate(type, pd);

    if (pd1 == encoder1.getPersistenceDelegate(type))
        throw new Error("first persistence delegate is not changed");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
源代码5 项目: openjdk-8   文件: Test4968523.java

private static void test(Class<?> type, PersistenceDelegate pd) {
    Encoder encoder1 = new Encoder();
    Encoder encoder2 = new XMLEncoder(System.out);

    PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
    PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);

    encoder1.setPersistenceDelegate(type, pd);

    if (pd1 == encoder1.getPersistenceDelegate(type))
        throw new Error("first persistence delegate is not changed");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
源代码6 项目: dragonwell8_jdk   文件: Test8005065.java

private static void testDefaultPersistenceDelegate() {
    Encoder encoder = new Encoder();
    String[] array = { "array" };
    MyDPD dpd = new MyDPD(array);
    dpd.instantiate(dpd, encoder);
    array[0] = null;
    dpd.instantiate(dpd, encoder);
}
 
源代码7 项目: jdk8u-jdk   文件: Test8005065.java

private static void testDefaultPersistenceDelegate() {
    Encoder encoder = new Encoder();
    String[] array = { "array" };
    MyDPD dpd = new MyDPD(array);
    dpd.instantiate(dpd, encoder);
    array[0] = null;
    dpd.instantiate(dpd, encoder);
}
 
源代码8 项目: openjdk-8   文件: Test5023552.java

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});
        }
    });
}
 
源代码9 项目: TencentKona-8   文件: Test5023552.java

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});
        }
    });
}
 
源代码10 项目: 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]);
                }
            }
    );
}
 
源代码11 项目: 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[] {});
        }
    });
}
 
源代码12 项目: java-swing-tips   文件: MainPanel.java

@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
@Override protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder encoder) {
  super.initialize(type, oldInstance, newInstance, encoder);
  DefaultTableModel m = (DefaultTableModel) oldInstance;
  for (int row = 0; row < m.getRowCount(); row++) {
    for (int col = 0; col < m.getColumnCount(); col++) {
      Object[] o = {m.getValueAt(row, col), row, col};
      encoder.writeStatement(new Statement(oldInstance, "setValueAt", o));
    }
  }
}
 
源代码13 项目: jdk8u_jdk   文件: Test5023552.java

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});
        }
    });
}
 
源代码14 项目: jdk8u60   文件: Test5023552.java

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});
        }
    });
}
 
源代码15 项目: 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]);
                }
            }
    );
}
 
源代码16 项目: jdk8u60   文件: Test8013416.java

@Override
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
    super.initialize(type, oldInstance, newInstance, out);

    Public<String, String> map = (Public) oldInstance;
    for (Entry<String, String> entry : map.getAll()) {
        String[] args = {entry.getKey(), entry.getValue()};
        out.writeStatement(new Statement(oldInstance, "put", args));
    }
}
 
源代码17 项目: jdk8u60   文件: Test4968523.java

private static void test(Class<?> type, PersistenceDelegate pd) {
    Encoder encoder1 = new Encoder();
    Encoder encoder2 = new XMLEncoder(System.out);

    PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
    PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);

    encoder1.setPersistenceDelegate(type, pd);

    if (pd1 == encoder1.getPersistenceDelegate(type))
        throw new Error("first persistence delegate is not changed");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
源代码18 项目: java-swing-tips   文件: MainPanel.java

@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
@Override protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder encoder) {
  super.initialize(type, oldInstance, newInstance, encoder);
  DefaultTableModel m = (DefaultTableModel) oldInstance;
  // Vector v = m.getDataVector();
  // for (int i = 0; i < m.getRowCount(); i++) {
  //   encoder.writeStatement(new Statement(oldInstance, "addRow", new Object[] { (Vector) v.get(i) }));
  // }
  for (int row = 0; row < m.getRowCount(); row++) {
    for (int col = 0; col < m.getColumnCount(); col++) {
      Object[] o = {m.getValueAt(row, col), row, col};
      encoder.writeStatement(new Statement(oldInstance, "setValueAt", o));
    }
  }
}
 
源代码19 项目: openjdk-jdk8u   文件: Test5023552.java

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});
        }
    });
}
 
源代码20 项目: openjdk-jdk9   文件: Test5023552.java

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});
        }
    });
}
 
源代码21 项目: openjdk-8-source   文件: 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[] {});
        }
    });
}
 
源代码22 项目: java-swing-tips   文件: MainPanel.java

@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
@Override protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder encoder) {
  super.initialize(type, oldInstance, newInstance, encoder);
  DefaultTableModel m = (DefaultTableModel) oldInstance;
  for (int row = 0; row < m.getRowCount(); row++) {
    for (int col = 0; col < m.getColumnCount(); col++) {
      Object[] o = {m.getValueAt(row, col), row, col};
      encoder.writeStatement(new Statement(oldInstance, "setValueAt", o));
    }
  }
}
 
源代码23 项目: development   文件: XMLSerializer.java

@Override
protected Expression instantiate(Object oldInstance, Encoder out) {
    byte[] e = (byte[]) oldInstance;
    return new Expression(e, ByteArrayPersistenceDelegate.class,
            "decode",
            new Object[] { ByteArrayPersistenceDelegate.encode(e) });
}
 
源代码24 项目: openjdk-jdk8u-backup   文件: Test5023552.java

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});
        }
    });
}
 
源代码25 项目: 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]);
                }
            }
    );
}
 
源代码26 项目: openjdk-jdk8u-backup   文件: Test8013416.java

@Override
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
    super.initialize(type, oldInstance, newInstance, out);

    Public<String, String> map = (Public) oldInstance;
    for (Entry<String, String> entry : map.getAll()) {
        String[] args = {entry.getKey(), entry.getValue()};
        out.writeStatement(new Statement(oldInstance, "put", args));
    }
}
 
源代码27 项目: jdk8u-jdk   文件: Test4968523.java

private static void test(Class<?> type, PersistenceDelegate pd) {
    Encoder encoder1 = new Encoder();
    Encoder encoder2 = new XMLEncoder(System.out);

    PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
    PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);

    encoder1.setPersistenceDelegate(type, pd);

    if (pd1 == encoder1.getPersistenceDelegate(type))
        throw new Error("first persistence delegate is not changed");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
源代码28 项目: jdk8u-dev-jdk   文件: Test4968523.java

private static void test(Class<?> type, PersistenceDelegate pd) {
    Encoder encoder1 = new Encoder();
    Encoder encoder2 = new XMLEncoder(System.out);

    PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
    PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);

    encoder1.setPersistenceDelegate(type, pd);

    if (pd1 == encoder1.getPersistenceDelegate(type))
        throw new Error("first persistence delegate is not changed");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
源代码29 项目: openjdk-jdk8u-backup   文件: Test8005065.java

private static void testDefaultPersistenceDelegate() {
    Encoder encoder = new Encoder();
    String[] array = { "array" };
    MyDPD dpd = new MyDPD(array);
    dpd.instantiate(dpd, encoder);
    array[0] = null;
    dpd.instantiate(dpd, encoder);
}
 
源代码30 项目: dragonwell8_jdk   文件: Test4950122.java

public static void main(String[] args) {
    TestBean bean = new TestBean(true, 11);
    Encoder encoder = new Encoder();
    encoder.setExceptionListener(bean);
    new TestDPD().instantiate(bean, encoder);
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法