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