• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CPropertyInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.tools.internal.xjc.model.CPropertyInfo的典型用法代码示例。如果您正苦于以下问题:Java CPropertyInfo类的具体用法?Java CPropertyInfo怎么用?Java CPropertyInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CPropertyInfo类属于com.sun.tools.internal.xjc.model包,在下文中一共展示了CPropertyInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generate

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的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() );
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:IsSetField.java


示例2: ConstField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
ConstField( ClassOutlineImpl outline, CPropertyInfo prop ) {
    super(outline,prop);

    // we only support value constraints for a single-value property.
    assert !prop.isCollection();

    JPrimitiveType ptype = implType.boxify().getPrimitiveType();

    // generate the constant
    JExpression defaultValue = null;
    if(prop.defaultValue!=null)
        defaultValue = prop.defaultValue.compute(outline.parent());

    $ref = outline.ref.field(JMod.PUBLIC|JMod.STATIC|JMod.FINAL,
        ptype!=null?ptype:implType, prop.getName(true), defaultValue );
    $ref.javadoc().append(prop.javadoc);

    annotate($ref);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:ConstField.java


示例3: build

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
public void build(XSComplexType ct) {
    XSContentType contentType = ct.getContentType();

    builder.recordBindingMode(ct, FALLBACK_CONTENT);
    BIProperty prop = BIProperty.getCustomization(ct);

    CPropertyInfo p;

    if(contentType.asEmpty()!=null) {
        p = prop.createValueProperty("Content",false,ct,CBuiltinLeafInfo.STRING,null);
    } else {
        RawTypeSet ts = RawTypeSetBuilder.build(contentType.asParticle(),false);
        p = prop.createReferenceProperty("Content", false, ct, ts, true, false, true, false);
    }

    selector.getCurrentBean().addProperty(p);

    // adds attributes and we are through.
    green.attContainer(ct);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:MultiWildcardComplexTypeBuilder.java


示例4: getDeclaredFields

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * Gets all the {@link FieldOutline}s newly declared
 * in this class.
 */
public final FieldOutline[] getDeclaredFields() {
    List<CPropertyInfo> props = target.getProperties();
    FieldOutline[] fr = new FieldOutline[props.size()];
    for( int i=0; i<fr.length; i++ )
        fr[i] = parent().getField(props.get(i));
    return fr;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ClassOutline.java


示例5: IsSetField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
protected IsSetField( ClassOutlineImpl outline, CPropertyInfo prop,
        FieldOutline core, boolean unsetMethod, boolean issetMethod ) {
    super(outline,prop);
    this.core = core;
    this.generateIsSetMethod = issetMethod;
    this.generateUnSetMethod = unsetMethod;

    generate(outline,prop);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:IsSetField.java


示例6: AbstractField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
protected AbstractField( ClassOutlineImpl outline, CPropertyInfo prop ) {
    this.outline = outline;
    this.prop = prop;
    this.codeModel = outline.parent().getCodeModel();
    this.implType = getType(IMPLEMENTATION);
    this.exposedType = getType(Aspect.EXPOSED);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:AbstractField.java


示例7: listPossibleTypes

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:AbstractField.java


示例8: NoExtendedContentField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * @param coreList
 *      A concrete class that implements the List interface.
 *      An instance of this class will be used to store data
 *      for this field.
 */
protected NoExtendedContentField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) {
    // the JAXB runtime picks ArrayList if the signature is List,
    // so don't do eager allocation if it's ArrayList.
    // otherwise we need to do eager allocation so that the collection type specified by the user
    // will be used.
    super(context, prop, false);
    this.coreList = coreList;
    generate();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:NoExtendedContentField.java


示例9: DummyListField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * @param coreList
 *      A concrete class that implements the List interface.
 *      An instance of this class will be used to store data
 *      for this field.
 */
protected DummyListField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) {
    // the JAXB runtime picks ArrayList if the signature is List,
    // so don't do eager allocation if it's ArrayList.
    // otherwise we need to do eager allocation so that the collection type specified by the user
    // will be used.
    super(context, prop, !coreList.fullName().equals("java.util.ArrayList"));
    this.coreList = coreList.narrow(exposedType.boxify());
    generate();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:DummyListField.java


示例10: AbstractListField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * Call {@link #generate()} method right after this.
 */
protected AbstractListField(ClassOutlineImpl outline, CPropertyInfo prop, boolean eagerInstanciation) {
    super(outline,prop);
    this.eagerInstanciation = eagerInstanciation;

    if( implType instanceof JPrimitiveType ) {
        // primitive types don't have this tricky distinction
        assert implType==exposedType;
        primitiveType = (JPrimitiveType)implType;
    } else
        primitiveType = null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:AbstractListField.java


示例11: UntypedListField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * @param coreList
 *      A concrete class that implements the List interface.
 *      An instance of this class will be used to store data
 *      for this field.
 */
protected UntypedListField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) {
    // the JAXB runtime picks ArrayList if the signature is List,
    // so don't do eager allocation if it's ArrayList.
    // otherwise we need to do eager allocation so that the collection type specified by the user
    // will be used.
    super(context, prop, !coreList.fullName().equals("java.util.ArrayList"));
    this.coreList = coreList.narrow(exposedType.boxify());
    generate();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:UntypedListField.java


示例12: ContentListField

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * @param coreList
 *      A concrete class that implements the List interface.
 *      An instance of this class will be used to store data
 *      for this field.
 */
protected ContentListField(ClassOutlineImpl context, CPropertyInfo prop, JClass coreList) {
    // the JAXB runtime picks ArrayList if the signature is List,
    // so don't do eager allocation if it's ArrayList.
    // otherwise we need to do eager allocation so that the collection type specified by the user
    // will be used.
    super(context, prop, false);
    this.coreList = coreList;
    generate();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:ContentListField.java


示例13: decideRenderer

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
private FieldRenderer decideRenderer(ClassOutlineImpl outline, CPropertyInfo prop) {

        if (prop instanceof CReferencePropertyInfo) {
            CReferencePropertyInfo p = (CReferencePropertyInfo)prop;
            if (p.isDummy()) {
                return frf.getDummyList(outline.parent().getCodeModel().ref(ArrayList.class));
            }
            if (p.isContent() && (p.isMixedExtendedCust())) {
                return frf.getContentList(outline.parent().getCodeModel().ref(ArrayList.class).narrow(Serializable.class));
            }
        }

        if(!prop.isCollection()) {
            // non-collection field

            // TODO: check for bidning info for optionalPrimitiveType=boxed or
            // noHasMethod=false and noDeletedMethod=false
            if(prop.isUnboxable())
                // this one uses a primitive type as much as possible
                return frf.getRequiredUnboxed();
            else
                // otherwise use the default non-collection field
                return frf.getSingle();
        }

        if( defaultCollectionFieldRenderer==null ) {
            return frf.getList(outline.parent().getCodeModel().ref(ArrayList.class));
        }

        // this field is a collection field.
        // use untyped list as the default. This is consistent
        // to the JAXB spec.
        return defaultCollectionFieldRenderer;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:35,代码来源:DefaultFieldRenderer.java


示例14: generate

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
public FieldOutline generate(ClassOutlineImpl context, CPropertyInfo prop) {
    if (dummy) {
        return new DummyListField(context, prop, coreList);
    }
    if (content) {
        return new ContentListField(context, prop, coreList);
    }
    return new UntypedListField(context, prop, coreList);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:UntypedListFieldRenderer.java


示例15: GenericFieldRenderer

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
public GenericFieldRenderer( Class fieldClass ) {
    try {
        constructor = fieldClass.getDeclaredConstructor(new Class[]{ClassOutlineImpl.class,CPropertyInfo.class});
    } catch (NoSuchMethodException e) {
        throw new NoSuchMethodError(e.getMessage());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:GenericFieldRenderer.java


示例16: generateFieldDecl

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * Determines the FieldRenderer used for the given FieldUse,
 * then generates the field declaration and accessor methods.
 *
 * The <code>fields</code> map will be updated with the newly
 * created FieldRenderer.
 */
private FieldOutline generateFieldDecl(ClassOutlineImpl cc, CPropertyInfo prop) {
    FieldRenderer fr = prop.realization;
    if (fr == null) // none is specified. use the default factory
    {
        fr = model.options.getFieldRendererFactory().getDefault();
    }

    FieldOutline field = fr.generate(cc, prop);
    fields.put(prop, field);

    return field;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:BeanGenerator.java


示例17: generateAdapterIfNecessary

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * Generates {@link XmlJavaTypeAdapter} from {@link PropertyInfo} if necessary.
 * Also generates other per-property annotations
 * (such as {@link XmlID}, {@link XmlIDREF}, and {@link XmlMimeType} if necessary.
 */
public final void generateAdapterIfNecessary(CPropertyInfo prop, JAnnotatable field) {
    CAdapter adapter = prop.getAdapter();
    if (adapter != null) {
        if (adapter.getAdapterIfKnown() == SwaRefAdapterMarker.class) {
            field.annotate(XmlAttachmentRef.class);
        } else {
            // [RESULT]
            // @XmlJavaTypeAdapter( Foo.class )
            XmlJavaTypeAdapterWriter xjtw = field.annotate2(XmlJavaTypeAdapterWriter.class);
            xjtw.value(adapter.adapterType.toType(this, EXPOSED));
        }
    }

    switch (prop.id()) {
        case ID:
            field.annotate(XmlID.class);
            break;
        case IDREF:
            field.annotate(XmlIDREF.class);
            break;
    }

    if (prop.getExpectedMimeType() != null) {
        field.annotate2(XmlMimeTypeWriter.class).value(prop.getExpectedMimeType().toString());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:BeanGenerator.java


示例18: handle

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * If the given component has {@link BIInlineBinaryData} customization,
 * reflect that to the specified property.
 */
public static void handle(XSComponent source, CPropertyInfo prop) {
    BIInlineBinaryData inline = Ring.get(BGMBuilder.class).getBindInfo(source).get(BIInlineBinaryData.class);
    if(inline!=null) {
        prop.inlineBinaryData = true;
        inline.markAsAcknowledged();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:BIInlineBinaryData.java


示例19: createElementOrReferenceProperty

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
public CPropertyInfo createElementOrReferenceProperty(
        String defaultName, boolean forConstant, XSParticle source,
        RawTypeSet types) {

    boolean generateRef;

    switch(types.canBeTypeRefs) {
    case CAN_BE_TYPEREF:
    case SHOULD_BE_TYPEREF:
        // it's up to the use
        Boolean b = generateElementProperty();
        if(b==null) // follow XJC recommendation
            generateRef = types.canBeTypeRefs== RawTypeSet.Mode.CAN_BE_TYPEREF;
        else // use the value user gave us
            generateRef = b;
        break;
    case MUST_BE_REFERENCE:
        generateRef = true;
        break;
    default:
        throw new AssertionError();
    }

    if(generateRef) {
        return createReferenceProperty(defaultName,forConstant,source,types, false, false, false, false);
    } else {
        return createElementProperty(defaultName,forConstant,source,types);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:BIProperty.java


示例20: readSuperClass

import com.sun.tools.internal.xjc.model.CPropertyInfo; //导入依赖的package包/类
/**
 * Reads fields of the super class and includes them
 * to name collision tests.
 */
void readSuperClass( CClassInfo base ) {
    for( ; base!=null; base=base.getBaseClass() ) {
        for( CPropertyInfo p : base.getProperties() )
            occupiedLabels.put(p.getName(true),p);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:DefaultParticleBinder.java



注:本文中的com.sun.tools.internal.xjc.model.CPropertyInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WildcardMode类代码示例发布时间:2022-05-23
下一篇:
Java ConnectionState类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap