当前位置: 首页>>代码示例>>Java>>正文


Java BIProperty.createAttributeProperty方法代码示例

本文整理汇总了Java中com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIProperty.createAttributeProperty方法的典型用法代码示例。如果您正苦于以下问题:Java BIProperty.createAttributeProperty方法的具体用法?Java BIProperty.createAttributeProperty怎么用?Java BIProperty.createAttributeProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIProperty的用法示例。


在下文中一共展示了BIProperty.createAttributeProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attributeUse

import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIProperty; //导入方法依赖的package包/类
/**
 * Attribute use always becomes a property.
 */
public void attributeUse(XSAttributeUse use) {
    boolean hasFixedValue = use.getFixedValue()!=null;
    BIProperty pc = BIProperty.getCustomization(use);

    // map to a constant property ?
    boolean toConstant = pc.isConstantProperty() && hasFixedValue;
    TypeUse attType = bindAttDecl(use.getDecl());

    CPropertyInfo prop = pc.createAttributeProperty( use, attType );

    if(toConstant) {
        prop.defaultValue = CDefaultValue.create(attType,use.getFixedValue());
        prop.realization = builder.fieldRendererFactory.getConst(prop.realization);
    } else
    if(!attType.isCollection() && (prop.baseType == null ? true : !prop.baseType.isPrimitive())) {
        // don't support a collection default value. That's difficult to do.
        // primitive types default value is problematic too - we can't check whether it has been set or no ( ==null) isn't possible TODO: emit a waring in these cases

        if(use.getDefaultValue()!=null) {
            // this attribute use has a default value.
            // the item type is guaranteed to be a leaf type... or TODO: is it really so?
            // don't support default values if it's a list
            prop.defaultValue = CDefaultValue.create(attType,use.getDefaultValue());
        } else
        if(use.getFixedValue()!=null) {
            prop.defaultValue = CDefaultValue.create(attType,use.getFixedValue());
        }
    } else if(prop.baseType != null && prop.baseType.isPrimitive()) {
        ErrorReporter errorReporter = Ring.get(ErrorReporter.class);

        errorReporter.warning(prop.getLocator(), Messages.WARN_DEFAULT_VALUE_PRIMITIVE_TYPE, prop.baseType.name());
    }

    getCurrentBean().addProperty(prop);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:BindPurple.java


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