当前位置: 首页>>代码示例>>Java>>正文


Java XMLEncoder.setOwner方法代码示例

本文整理汇总了Java中java.beans.XMLEncoder.setOwner方法的典型用法代码示例。如果您正苦于以下问题:Java XMLEncoder.setOwner方法的具体用法?Java XMLEncoder.setOwner怎么用?Java XMLEncoder.setOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.beans.XMLEncoder的用法示例。


在下文中一共展示了XMLEncoder.setOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import java.beans.XMLEncoder; //导入方法依赖的package包/类
@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());
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:Test5023550.java

示例2: savePainterToFile

import java.beans.XMLEncoder; //导入方法依赖的package包/类
static public void savePainterToFile(Painter compoundPainter, File file, URL baseURL) throws IOException {
    //System.setErr(null);
    //        u.p("writing out to: " + file.getCanonicalPath());
    setTransient(ImagePainter.class, "image");
    setTransient(ImagePainter.class, "imageString");
    //setTransient(CompoundPainter.class,"antialiasing");
    //setTransient(AbstractPainter.class,"antialiasing");
    //setTransient(AbstractPainter.class,"renderingHints");
    //setPropertyDelegate();
    
    XMLEncoder e = new XMLEncoder(new FileOutputStream(file));
    e.setOwner(new PersistenceOwner(baseURL));
    //p("owner = " + e.getOwner());
    //e.setOwner(compoundPainter);
    
    // serialize the enums
    //e.setPersistenceDelegate(AbstractPainter.Antialiasing.class, new TypeSafeEnumPersistenceDelegate());
    e.setPersistenceDelegate(AbstractPainter.Interpolation.class, new TypeSafeEnumPersistenceDelegate());
   // e.setPersistenceDelegate(AbstractPainter.FractionalMetrics.class, new TypeSafeEnumPersistenceDelegate());
    e.setPersistenceDelegate(RectanglePainter.Style.class, new TypeSafeEnumPersistenceDelegate());
    e.setPersistenceDelegate(AbstractLayoutPainter.HorizontalAlignment.class, new TypeSafeEnumPersistenceDelegate());
    e.setPersistenceDelegate(AbstractLayoutPainter.VerticalAlignment.class, new TypeSafeEnumPersistenceDelegate());
    
    
    e.setPersistenceDelegate(AbstractPainter.class, new AbstractPainterDelegate());
    e.setPersistenceDelegate(ImagePainter.class, new ImagePainterDelegate());
    e.setPersistenceDelegate(RenderingHints.class, new RenderingHintsDelegate());
    e.setPersistenceDelegate(GradientPaint.class, new GradientPaintDelegate());
    e.setPersistenceDelegate(Arc2D.Float.class, new Arc2DDelegate());
    e.setPersistenceDelegate(Arc2D.Double.class, new Arc2DDelegate());
    e.setPersistenceDelegate(CubicCurve2D.Float.class, new CubicCurve2DDelegate());
    e.setPersistenceDelegate(CubicCurve2D.Double.class, new CubicCurve2DDelegate());
    e.setPersistenceDelegate(Ellipse2D.Float.class, new Ellipse2DDelegate());
    e.setPersistenceDelegate(Ellipse2D.Double.class, new Ellipse2DDelegate());
    e.setPersistenceDelegate(Line2D.Float.class, new Line2DDelegate());
    e.setPersistenceDelegate(Line2D.Double.class, new Line2DDelegate());
    e.setPersistenceDelegate(Point2D.Float.class, new Point2DDelegate());
    e.setPersistenceDelegate(Point2D.Double.class, new Point2DDelegate());
    e.setPersistenceDelegate(QuadCurve2D.Float.class, new QuadCurve2DDelegate());
    e.setPersistenceDelegate(QuadCurve2D.Double.class, new QuadCurve2DDelegate());
    e.setPersistenceDelegate(Rectangle2D.Float.class, new Rectangle2DDelegate());
    e.setPersistenceDelegate(Rectangle2D.Double.class, new Rectangle2DDelegate());
    e.setPersistenceDelegate(RoundRectangle2D.Float.class, new RoundRectangle2DDelegate());
    e.setPersistenceDelegate(RoundRectangle2D.Double.class, new RoundRectangle2DDelegate());
    e.setPersistenceDelegate(Area.class, new AreaDelegate());
    e.setPersistenceDelegate(GeneralPath.class, new GeneralPathDelegate());
    e.setPersistenceDelegate(AffineTransform.class, new AffineTransformDelegate());
    e.setPersistenceDelegate(RadialGradientPaint.class, new RadialGradientPaintDelegate());
    e.setPersistenceDelegate(LinearGradientPaint.class, new LinearGradientPaintDelegate());
    e.setPersistenceDelegate(Insets.class, new InsetsDelegate());
    
    e.writeObject(compoundPainter);
    e.close();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:55,代码来源:PainterUtil.java


注:本文中的java.beans.XMLEncoder.setOwner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。