本文整理汇总了Java中java.beans.Encoder.writeStatement方法的典型用法代码示例。如果您正苦于以下问题:Java Encoder.writeStatement方法的具体用法?Java Encoder.writeStatement怎么用?Java Encoder.writeStatement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.Encoder
的用法示例。
在下文中一共展示了Encoder.writeStatement方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import java.beans.Encoder; //导入方法依赖的package包/类
@Override
protected void initialize(Class type, Object oldInstance,
Object newInstance, Encoder out) {
// p("image painter delegate called");
super.initialize(type, oldInstance, newInstance, out);
//p("old instance = " + oldInstance);
//p("owner = " + ((XMLEncoder)out).getOwner());
PersistenceOwner owner = (PersistenceOwner)((XMLEncoder)out).getOwner();
ImagePainter ip = (ImagePainter)oldInstance;
// p("need to convert string: " + ip.getImageString());
// String s = owner.toXMLURL(ip.getImageString());
// p("converted to: " + s);
//out.writeExpression(new Expression(oldInstance,owner,"fromXMLURL",new Object[]{ip.getImageString()}));
//out.writeStatement(new Statement(owner,"fromXMLURL",new Object[]{ip.getImageString()}));
//out.writeStatement(new Statement(oldInstance,"setImageString",new Object[]{
//new Expression(oldInstance,owner,"fromXMLURL",new Object[]{ip.getImageString()})
//}));
out.writeStatement(new Statement(oldInstance,"setResolver",new Object[]{owner}));
// out.writeStatement(new Statement(oldInstance,"setImageString",new Object[]{s}));
}
示例2: initialize
import java.beans.Encoder; //导入方法依赖的package包/类
@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));
}
}
示例3: initialize
import java.beans.Encoder; //导入方法依赖的package包/类
@Override
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
java.util.Collection oldO = (java.util.Collection) oldInstance;
java.util.Collection newO = (java.util.Collection) newInstance;
if (newO.size() != 0) {
out.writeStatement(new Statement(oldInstance, "clear", new Object[] {}));
}
for (Iterator i = oldO.iterator(); i.hasNext();) {
out.writeStatement(new Statement(oldInstance, "add", new Object[] {i.next()}));
}
}
示例4: initialize
import java.beans.Encoder; //导入方法依赖的package包/类
protected void initialize(Class type, Object oldInstance, Object newInstance,
Encoder out)
{
Iterator ite = ((Collection) oldInstance).iterator();
while (ite.hasNext())
{
out.writeStatement(new Statement(oldInstance, "add",
new Object[] { ite.next() }));
}
}
示例5: initialize
import java.beans.Encoder; //导入方法依赖的package包/类
protected void initialize(Class type, Object oldInstance, Object newInstance,
Encoder out)
{
Map map = (Map) oldInstance;
Iterator ite = map.keySet().iterator();
while (ite.hasNext())
{
Object key = ite.next();
out.writeStatement(new Statement(oldInstance, "put",
new Object[] { key, map.get(key) }));
}
}
示例6: instantiate
import java.beans.Encoder; //导入方法依赖的package包/类
@Override
protected Expression instantiate(Object oldInstance, Encoder out) {
Area a = (Area)oldInstance;
//use the default constructor
AffineTransform tx = new AffineTransform();
PathIterator itr = a.getPathIterator(tx);
GeneralPath path = new GeneralPath();
out.writeExpression(new Expression(path, GeneralPath.class, "new", new Object[0]));
while (!itr.isDone()) {
float[] segment = new float[6]; //must use floats because lineTo etc use floats
int pathType = itr.currentSegment(segment);
switch (pathType) {
case PathIterator.SEG_CLOSE:
out.writeStatement(new Statement(path, "closePath", new Object[0]));
break;
case PathIterator.SEG_CUBICTO:
out.writeStatement(new Statement(path, "curveTo", new Object[] {segment[0], segment[1], segment[2], segment[3], segment[4], segment[5]}));
break;
case PathIterator.SEG_LINETO:
out.writeStatement(new Statement(path, "lineTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_MOVETO:
out.writeStatement(new Statement(path, "moveTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_QUADTO:
out.writeStatement(new Statement(path, "quadTo", new Object[] {segment[0], segment[1], segment[2], segment[3]}));
break;
}
itr.next();
}
return new Expression(a, Area.class, "new", new Object[] {path});
}
示例7: initialize
import java.beans.Encoder; //导入方法依赖的package包/类
@Override
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out) {
GeneralPath a = (GeneralPath)oldInstance;
AffineTransform tx = new AffineTransform();
PathIterator itr = a.getPathIterator(tx);
out.writeStatement(new Statement(a, "setWindingRule", new Object[] {a.getWindingRule()}));
while (!itr.isDone()) {
float[] segment = new float[6]; //must use floats because lineTo etc use floats
int pathType = itr.currentSegment(segment);
switch (pathType) {
case PathIterator.SEG_CLOSE:
out.writeStatement(new Statement(a, "closePath", new Object[0]));
break;
case PathIterator.SEG_CUBICTO:
out.writeStatement(new Statement(a, "curveTo", new Object[] {segment[0], segment[1], segment[2], segment[3], segment[4], segment[5]}));
break;
case PathIterator.SEG_LINETO:
out.writeStatement(new Statement(a, "lineTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_MOVETO:
out.writeStatement(new Statement(a, "moveTo", new Object[] {segment[0], segment[1]}));
break;
case PathIterator.SEG_QUADTO:
out.writeStatement(new Statement(a, "quadTo", new Object[] {segment[0], segment[1], segment[2], segment[3]}));
break;
}
itr.next();
}
}
示例8: testWriteStatement_Null
import java.beans.Encoder; //导入方法依赖的package包/类
public void testWriteStatement_Null() {
Encoder enc = new Encoder();
try {
enc.writeStatement(null);
fail("NPE expected");
} catch (NullPointerException e) {
// expected
}
}
示例9: initialize
import java.beans.Encoder; //导入方法依赖的package包/类
protected void initialize( Class type, Object oldInstance, Object newInstance, Encoder out ) {
Point2D point = (Point2D) oldInstance;
out.writeStatement( new Statement( oldInstance,
"setLocation",
new Object[] { new Double( point.getX() ), new Double( point.getY() ) } ) );
}