本文整理了Java中java.beans.XMLEncoder.setPersistenceDelegate()
方法的一些代码示例,展示了XMLEncoder.setPersistenceDelegate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLEncoder.setPersistenceDelegate()
方法的具体详情如下:
包路径:java.beans.XMLEncoder
类名称:XMLEncoder
方法名:setPersistenceDelegate
暂无
代码示例来源:origin: oracle/opengrok
XMLEncoder e = new XMLEncoder(new GZIPOutputStream(
new BufferedOutputStream(out)))) {
e.setPersistenceDelegate(File.class,
new FilePersistenceDelegate());
e.writeObject(history);
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public static void addHivePersistenceDelegates(XMLEncoder e)
{
e.setPersistenceDelegate(PrimitiveTypeInfo.class,
new PersistenceDelegate()
{
@Override
protected Expression instantiate(Object oldInstance,
Encoder out)
{
return new Expression(oldInstance,
TypeInfoFactory.class, "getPrimitiveTypeInfo",
new Object[]
{ ((PrimitiveTypeInfo) oldInstance)
.getTypeName() });
}
});
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
private XMLEncoder getXmlEncoder(String filename)
throws FileNotFoundException {
XMLEncoder result = null;
BufferedOutputStream os =
new BufferedOutputStream(new FileOutputStream(filename));
result = new XMLEncoder(os);
result.setPersistenceDelegate(ArtifactAction.class, enumDelegate);
return result;
}
}
代码示例来源:origin: org.ihtsdo/wb-api
protected XMLEncoder getEncoder(File changeset) throws FileNotFoundException {
XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(new File(
changeset.getParent(), changeset.getName() + outputSuffix))));
encoder.setPersistenceDelegate(UUID.class, new java.beans.PersistenceDelegate() {
protected Expression instantiate(Object oldInstance, Encoder out) {
return new Expression(oldInstance, oldInstance.getClass(), "fromString",
new Object[] { oldInstance.toString() });
}
});
return encoder;
}
代码示例来源:origin: realXuJiang/bigtable-sql
private XMLEncoder getXmlEncoder(String filename)
throws FileNotFoundException {
XMLEncoder result = null;
BufferedOutputStream os =
new BufferedOutputStream(new FileOutputStream(filename));
result = new XMLEncoder(os);
result.setPersistenceDelegate(ArtifactAction.class, enumDelegate);
return result;
}
}
代码示例来源:origin: christian-schlichtherle/truelicense
@Override
XMLEncoder encoder(final OutputStream out) {
final XMLEncoder enc = super.encoder(out);
enc.setPersistenceDelegate(X500Principal.class, delegate);
return enc;
}
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
public static void addEnumDelegates(XMLEncoder e)
{
e.setPersistenceDelegate(Direction.class, new EnumDelegate());
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
/**
* Serialize a single Task.
*/
public static void serializeTasks(Task<? extends Serializable> t, OutputStream out) {
XMLEncoder e = new XMLEncoder(out);
// workaround for java 1.5
e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
e.setPersistenceDelegate(Operator.ProgressCounter.class, new EnumDelegate());
e.writeObject(t);
e.close();
}
代码示例来源:origin: com.facebook.presto.hive/hive-apache
/**
* Serialize the object. This helper function mainly makes sure that enums,
* counters, etc are handled properly.
*/
private static void serializeObjectByJavaXML(Object plan, OutputStream out) {
XMLEncoder e = new XMLEncoder(out);
e.setExceptionListener(new ExceptionListener() {
@Override
public void exceptionThrown(Exception e) {
LOG.warn(org.apache.hadoop.util.StringUtils.stringifyException(e));
throw new RuntimeException("Cannot serialize object", e);
}
});
// workaround for java 1.5
e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
e.setPersistenceDelegate(java.sql.Date.class, new DatePersistenceDelegate());
e.setPersistenceDelegate(Timestamp.class, new TimestampPersistenceDelegate());
e.setPersistenceDelegate(org.datanucleus.store.types.backed.Map.class, new MapDelegate());
e.setPersistenceDelegate(org.datanucleus.store.types.backed.List.class, new ListDelegate());
e.setPersistenceDelegate(CommonToken.class, new CommonTokenDelegate());
e.setPersistenceDelegate(Path.class, new PathDelegate());
e.writeObject(plan);
e.close();
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
/**
* Serialize the mapredWork object to an output stream. DO NOT use this to write to standard
* output since it closes the output stream. DO USE mapredWork.toXML() instead.
*/
public static void serializeMapRedWork(MapredWork w, OutputStream out) {
XMLEncoder e = new XMLEncoder(out);
// workaround for java 1.5
e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
e.writeObject(w);
e.close();
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
/**
* Serialize the mapredLocalWork object to an output stream. DO NOT use this to write to standard
* output since it closes the output stream. DO USE mapredWork.toXML() instead.
*/
public static void serializeMapRedLocalWork(MapredLocalWork w, OutputStream out) {
XMLEncoder e = new XMLEncoder(out);
// workaround for java 1.5
e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
e.writeObject(w);
e.close();
}
代码示例来源:origin: org.apache.hadoop.hive/hive-exec
/**
* Serialize the whole query plan.
*/
public static void serializeQueryPlan(QueryPlan plan, OutputStream out) {
XMLEncoder e = new XMLEncoder(out);
e.setExceptionListener(new ExceptionListener() {
public void exceptionThrown(Exception e) {
LOG.warn(org.apache.hadoop.util.StringUtils.stringifyException(e));
throw new RuntimeException("Cannot serialize the query plan", e);
}
});
// workaround for java 1.5
e.setPersistenceDelegate(ExpressionTypes.class, new EnumDelegate());
e.setPersistenceDelegate(GroupByDesc.Mode.class, new EnumDelegate());
e.setPersistenceDelegate(Operator.ProgressCounter.class, new EnumDelegate());
e.setPersistenceDelegate(org.datanucleus.sco.backed.Map.class, new MapDelegate());
e.setPersistenceDelegate(org.datanucleus.sco.backed.List.class, new ListDelegate());
e.writeObject(plan);
e.close();
}
代码示例来源:origin: org.swinglabs.swingx/swingx-beaninfo
e.setPersistenceDelegate(AbstractPainter.Interpolation.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());
代码示例来源:origin: jtrfp/terminal-recall
e.printStackTrace();
}});
xmlEnc.setPersistenceDelegate(DefaultListModel.class,
new DefaultPersistenceDelegate() {
protected void initialize(Class clazz,
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime
e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
e.setExceptionListener(el);
e.writeObject(states);
代码示例来源:origin: org.nuiton/nuiton-widgets
e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
e.setExceptionListener(el);
e.writeObject(states);
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-session
e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
e.setExceptionListener(el);
e.writeObject(states);
代码示例来源:origin: jtrfp/terminal-recall
e.printStackTrace();
}});
xmlEnc.setPersistenceDelegate(DefaultListModel.class,
new DefaultPersistenceDelegate() {
protected void initialize(Class clazz,
代码示例来源:origin: org.jdesktop.bsaf/bsaf
e = new XMLEncoder(bst);
if (!persistenceDelegatesInitialized) {
e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
persistenceDelegatesInitialized = true;
代码示例来源:origin: net.java.dev.appframework/appframework
e = new XMLEncoder(bst);
if (!persistenceDelegatesInitialized) {
e.setPersistenceDelegate(Rectangle.class, new RectanglePD());
persistenceDelegatesInitialized = true;
内容来源于网络,如有侵权,请联系作者删除!