本文整理汇总了Java中com.sun.tools.internal.xjc.outline.FieldAccessor类的典型用法代码示例。如果您正苦于以下问题:Java FieldAccessor类的具体用法?Java FieldAccessor怎么用?Java FieldAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldAccessor类属于com.sun.tools.internal.xjc.outline包,在下文中一共展示了FieldAccessor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generate
import com.sun.tools.internal.xjc.outline.FieldAccessor; //导入依赖的package包/类
private void generate( ClassOutlineImpl outline, CPropertyInfo prop ) {
// add isSetXXX and unsetXXX.
MethodWriter writer = outline.createMethodWriter();
JCodeModel codeModel = outline.parent().getCodeModel();
FieldAccessor acc = core.create(JExpr._this());
if( generateIsSetMethod ) {
// [RESULT] boolean isSetXXX()
JExpression hasSetValue = acc.hasSetValue();
if( hasSetValue==null ) {
// this field renderer doesn't support the isSet/unset methods generation.
// issue an error
throw new UnsupportedOperationException();
}
writer.declareMethod(codeModel.BOOLEAN,"isSet"+this.prop.getName(true))
.body()._return( hasSetValue );
}
if( generateUnSetMethod ) {
// [RESULT] void unsetXXX()
acc.unsetValues(
writer.declareMethod(codeModel.VOID,"unset"+this.prop.getName(true)).body() );
}
}
示例2: create
import com.sun.tools.internal.xjc.outline.FieldAccessor; //导入依赖的package包/类
public FieldAccessor create(JExpression targetObject) {
return new Accessor(targetObject) {
public void unsetValues( JBlock body ) {
// you can't unset a value
}
public JExpression hasSetValue() {
return JExpr.TRUE;
}
};
}
示例3: create
import com.sun.tools.internal.xjc.outline.FieldAccessor; //导入依赖的package包/类
public FieldAccessor create(JExpression targetObject) {
return new Accessor(targetObject);
}
示例4: create
import com.sun.tools.internal.xjc.outline.FieldAccessor; //导入依赖的package包/类
public FieldAccessor create(JExpression target) {
return new Accessor(target);
}
示例5: create
import com.sun.tools.internal.xjc.outline.FieldAccessor; //导入依赖的package包/类
public FieldAccessor create(JExpression targetObject) {
return new FieldAccessorImpl(targetObject);
}