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


Java TypeUse类代码示例

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


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

示例1: getTypeUse

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
public TypeUse getTypeUse(XSSimpleType owner) {
    if(typeUse!=null)
        return typeUse;

    JCodeModel cm = getCodeModel();

    JDefinedClass a;
    try {
        a = cm._class(adapter);
        a.hide();   // we assume this is given by the user
        a._extends(cm.ref(XmlAdapter.class).narrow(String.class).narrow(
                cm.ref(type)));
    } catch (JClassAlreadyExistsException e) {
        a = e.getExistingClass();
    }

    // TODO: it's not correct to say that it adapts from String,
    // but OTOH I don't think we can compute that.
    typeUse = TypeUseFactory.adapt(
            CBuiltinLeafInfo.STRING,
            new CAdapter(a));

    return typeUse;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:BIConversion.java

示例2: createValueProperty

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
public CValuePropertyInfo createValueProperty(String defaultName,boolean forConstant,
    XSComponent source,TypeUse tu, QName typeName) {

    markAsAcknowledged();
    constantPropertyErrorCheck();

    String name = getPropertyName(forConstant);
    if(name==null) {
        name = defaultName;
        if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode())
            name = JJavaName.getPluralForm(name);
    }

    CValuePropertyInfo prop = wrapUp(new CValuePropertyInfo(name, source, getCustomizations(source), source.getLocator(), tu, typeName), source);
    BIInlineBinaryData.handle(source, prop);
    return prop;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:BIProperty.java

示例3: createAttributeProperty

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) {

        boolean forConstant =
            getCustomization(use).isConstantProperty() &&
            use.getFixedValue()!=null;

        String name = getPropertyName(forConstant);
        if(name==null) {
            NameConverter conv = getBuilder().getNameConverter();
            if(forConstant)
                name = conv.toConstantName(use.getDecl().getName());
            else
                name = conv.toPropertyName(use.getDecl().getName());
            if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode())
                name = JJavaName.getPluralForm(name);
        }

        markAsAcknowledged();
        constantPropertyErrorCheck();

        return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(),
                BGMBuilder.getName(use.getDecl()), tu,
                BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use);
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:BIProperty.java

示例4: getJavaType

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
public TypeAndAnnotation getJavaType(QName xmlTypeName) {
    // TODO: primitive type handling?
    TypeUse use = model.typeUses().get(xmlTypeName);
    if(use==null)   return null;

    return new TypeAndAnnotationImpl(outline,use);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:JAXBModelImpl.java

示例5: ElementMappingImpl

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
protected ElementMappingImpl(JAXBModelImpl parent, CElementInfo elementInfo) {
    super(parent,elementInfo);

    TypeUse t = clazz.getContentType();
    if(clazz.getProperty().isCollection())
        t = TypeUseFactory.makeCollection(t);
    CAdapter a = clazz.getProperty().getAdapter();
    if(a!=null)
        t = TypeUseFactory.adapt(t,a);
    taa = new TypeAndAnnotationImpl(parent.outline,t);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:ElementMappingImpl.java

示例6: attributeUse

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的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

示例7: bindAttDecl

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
private TypeUse bindAttDecl(XSAttributeDecl decl) {
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push( decl );
    try {
        return stb.build(decl.getType());
    } finally {
        stb.refererStack.pop();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:BindPurple.java

示例8: build

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
/**
 * Entry point from outside. Builds a BGM type expression
 * from a simple type schema component.
 *
 * @param type
 *      the simple type to be bound.
 */
public TypeUse build( XSSimpleType type ) {
    XSSimpleType oldi = initiatingType;
    this.initiatingType = type;

    TypeUse e = checkRefererCustomization(type);
    if(e==null)
        e = compose(type);

    initiatingType = oldi;

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

示例9: buildDef

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
/**
 * A version of the {@link #build(XSSimpleType)} method
 * used to bind the definition of a class generated from
 * the given simple type.
 */
public TypeUse buildDef( XSSimpleType type ) {
    XSSimpleType oldi = initiatingType;
    this.initiatingType = type;

    TypeUse e = type.apply(composer);

    initiatingType = oldi;

    return e;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:SimpleTypeBuilder.java

示例10: listSimpleType

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
public TypeUse listSimpleType(XSListSimpleType type) {
    // bind item type individually and then compose them into a list
    // facets on the list shouldn't be taken account when binding item types,
    // so weed to call build(), not compose().
    XSSimpleType itemType = type.getItemType();
    refererStack.push(itemType);
    TypeUse tu = TypeUseFactory.makeCollection(build(type.getItemType()));
    refererStack.pop();
    return tu;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:SimpleTypeBuilder.java

示例11: unionSimpleType

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
public TypeUse unionSimpleType(XSUnionSimpleType type) {
    boolean isCollection = false;
    for( int i=0; i<type.getMemberSize(); i++ )
        if(type.getMember(i).getVariety()==XSVariety.LIST || type.getMember(i).getVariety()==XSVariety.UNION) {
            isCollection = true;
            break;
        }

    TypeUse r = CBuiltinLeafInfo.STRING;
    if(isCollection)
        r = TypeUseFactory.makeCollection(r);
    return r;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:SimpleTypeBuilder.java

示例12: XmlTypeRef

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
public XmlTypeRef(XSElementDecl decl) {
    this.decl = decl;
    SimpleTypeBuilder stb = Ring.get(SimpleTypeBuilder.class);
    stb.refererStack.push(decl);
    TypeUse r = Ring.get(ClassSelector.class).bindToType(decl.getType(),decl);
    stb.refererStack.pop();
    target = r;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:RawTypeSetBuilder.java

示例13: createAttribute

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
protected CPropertyInfo createAttribute(
    String elementName, String attributeName, String attributeType,
    String[] enums, short attributeUse, String defaultValue )
        throws SAXException {

    boolean required = attributeUse==USE_REQUIRED;

    // get the attribute-property declaration
    BIElement edecl = bindInfo.element(elementName);
    BIAttribute decl=null;
    if(edecl!=null)     decl=edecl.attribute(attributeName);

    String propName;
    if(decl==null)  propName = model.getNameConverter().toPropertyName(attributeName);
    else            propName = decl.getPropertyName();

    QName qname = new QName("",attributeName);

    // if no declaration is specified, just wrap it by
    // a FieldItem and let the normalizer handle its content.
    TypeUse use;

    if(decl!=null && decl.getConversion()!=null)
        use = decl.getConversion().getTransducer();
    else
        use = builtinConversions.get(attributeType);

    CPropertyInfo r = new CAttributePropertyInfo(
        propName, null,null/*TODO*/, copyLocator(), qname, use, null, required );

    if(defaultValue!=null)
        r.defaultValue = CDefaultValue.create( use, new XmlString(defaultValue) );

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

示例14: getConversion

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
/**
 * When this element is an PCDATA-only content model,
 * returns the conversion for it. Otherwise the behavior is undefined.
 */
private TypeUse getConversion() {
    assert contentModel == Term.EMPTY; // this is PCDATA-only element

    BIElement e = owner.bindInfo.element(name);
    if(e!=null) {
        BIConversion conv = e.getConversion();
        if(conv!=null)
            return conv.getTransducer();
    }
    return CBuiltinLeafInfo.STRING;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:Element.java

示例15: onDataType

import com.sun.tools.internal.xjc.model.TypeUse; //导入依赖的package包/类
private TypeUse onDataType(String datatypeLibrary, String type) {
    DatatypeLib lib = compiler.datatypes.get(datatypeLibrary);
    if(lib!=null) {
        TypeUse use = lib.get(type);
        if(use!=null)
            return use;
    }

    // unknown
    return CBuiltinLeafInfo.STRING;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:TypeUseBinder.java


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