java.beans.Encoder.setPersistenceDelegate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中java.beans.Encoder.setPersistenceDelegate()方法的一些代码示例,展示了Encoder.setPersistenceDelegate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Encoder.setPersistenceDelegate()方法的具体详情如下:
包路径:java.beans.Encoder
类名称:Encoder
方法名:setPersistenceDelegate

Encoder.setPersistenceDelegate介绍

暂无

代码示例

代码示例来源:origin: com.globalmentor/globalmentor-core

/**
 * Upgrades an encoder to support encoding of other non-JavaBean classes. New classes supported are:
 * <ul>
 * <li><code>File</code> - Constructed by <code>File.getAbsolutePath</code></li>
 * </ul>
 * @param encoder The encoder to be upgraded.
 */
public static void upgradeEncoder(final Encoder encoder) {
  //File
  encoder.setPersistenceDelegate(File.class, new DefaultPersistenceDelegate(new String[] { "absolutePath" }));
}

代码示例来源:origin: de.schlichtherle.truelicense/truelicense-xml

/**
 * Installs all persistence delegates registered via
 * {@code {@link #setPersistenceDelegate(Class, PersistenceDelegate)}} in
 * {@code encoder}.
 *
 * @param  encoder the encoder - may <em>not</em> be {@code null}.
 * @throws NullPointerException if {@code encoder} is {@code null}.
 */
protected static synchronized void installPersistenceDelegates(
    final Encoder encoder) {
  final Iterator i = allPDs.entrySet().iterator();
  while (i.hasNext()) {
    final Map.Entry entry = (Map.Entry) i.next();
    encoder.setPersistenceDelegate(
        (Class) entry.getKey(),
        (PersistenceDelegate) entry.getValue());
  }
}

代码示例来源:origin: stackoverflow.com

XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(file))));
 for (Map.Entry<Class<?>, PersistenceDelegate> entry : MY_DELEGATES.entrySet()) {
   // Add any custom persistence delegates written.
   encoder.setPersistenceDelegate(entry.getKey(), entry.getValue());
 }
 encoder.writeObject(object);
 encoder.close();
 if (encoder.getException() != null) {
  // Encoding failed.
 }

代码示例来源:origin: stackoverflow.com

XMLEncoder encoder = new XMLEncoder(new FileOutputStream(file));
encoder.setPersistenceDelegate(
  Rectangle.class, 
  new DefaultPersistenceDelegate(new String[]{"x", "y", "width", "height"}));
encoder.writeObject(groups);
encoder.close();

代码示例来源:origin: stackoverflow.com

encoder.setPersistenceDelegate(Locale.class, new PersistenceDelegate() {
  protected Expression instantiate(Object oldInstance, Encoder out) {
    Locale l = (Locale) oldInstance;

代码示例来源:origin: stackoverflow.com

try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
 XMLEncoder xe = new XMLEncoder(os);
 xe.setPersistenceDelegate(
   DefaultTableModel.class, new DefaultTableModelPersistenceDelegate());

代码示例来源:origin: stackoverflow.com

encoder.setPersistenceDelegate(ExampleBean.class,
  new FullPersistenceDelegate());

代码示例来源:origin: stackoverflow.com

xe.setPersistenceDelegate(DefaultTableModel.class, new DefaultTableModelPersistenceDelegate2());
xe.writeObject(model);
xe.close();

代码示例来源:origin: stackoverflow.com

xe.setPersistenceDelegate(DefaultTableModel.class, new DefaultTableModelPersistenceDelegate2());
xe.writeObject(model);
xe.close();

代码示例来源:origin: stackoverflow.com

xe.setPersistenceDelegate(DefaultTableModel.class, new DefaultTableModelPersistenceDelegate());
xe.writeObject(model);
xe.close();

代码示例来源:origin: stackoverflow.com

xe.setPersistenceDelegate(DefaultTableModel.class, new DefaultTableModelPersistenceDelegate());
xe.writeObject(model);
xe.close();

代码示例来源:origin: stackoverflow.com

xe.setPersistenceDelegate(DefaultTableModel.class, new DefaultTableModelPersistenceDelegate());
xe.writeObject(model);
xe.close();

相关文章