當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。