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

Java JJavaName类代码示例

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

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



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

示例1: createValueProperty

import com.sun.codemodel.internal.JJavaName; //导入依赖的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


示例2: createAttributeProperty

import com.sun.codemodel.internal.JJavaName; //导入依赖的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


示例3: CPropertyInfo

import com.sun.codemodel.internal.JJavaName; //导入依赖的package包/类
protected CPropertyInfo(String name, boolean collection, XSComponent source,
                        CCustomizations customizations, Locator locator) {
    this.publicName = name;
    String n = null;

    Model m = Ring.get(Model.class);
    if (m != null) {
        n = m.getNameConverter().toVariableName(name);
    } else {
        n = NameConverter.standard.toVariableName(name);
    }

    if(!JJavaName.isJavaIdentifier(n))
        n = '_'+n;  // avoid colliding with the reserved names like 'abstract'.
    this.privateName = n;

    this.isCollection = collection;
    this.locator = locator;
    if(customizations==null)
        this.customizations = CCustomizations.EMPTY;
    else
        this.customizations = customizations;
    this.source = source;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:CPropertyInfo.java


示例4: CPropertyInfo

import com.sun.codemodel.internal.JJavaName; //导入依赖的package包/类
protected CPropertyInfo(String name, boolean collection, XSComponent source,
                        CCustomizations customizations, Locator locator) {
    this.publicName = name;
    String n = NameConverter.standard.toVariableName(name);
    if(!JJavaName.isJavaIdentifier(n))
        n = '_'+n;  // avoid colliding with the reserved names like 'abstract'.
    this.privateName = n;

    this.isCollection = collection;
    this.locator = locator;
    if(customizations==null)
        this.customizations = CCustomizations.EMPTY;
    else
        this.customizations = customizations;
    this.source = source;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:17,代码来源:CPropertyInfo.java


示例5: makeJavaName

import com.sun.codemodel.internal.JJavaName; //导入依赖的package包/类
/** Converts an XML name to the corresponding Java name. */
protected final String makeJavaName( boolean isRepeated, String xmlName ) {
    String name = builder.getNameConverter().toPropertyName(xmlName);
    if(builder.getGlobalBinding().isSimpleMode() && isRepeated )
        name = JJavaName.getPluralForm(name);
    return name;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ParticleBinder.java


示例6: getPackage

import com.sun.codemodel.internal.JJavaName; //导入依赖的package包/类
/**
 * Gets the Java package to which classes from
 * this namespace should go.
 *
 * <p>
 * Usually, the getOuterClass method should be used
 * to determine where to put a class.
 */
public JPackage getPackage(String targetNamespace) {
    XSSchema s = Ring.get(XSSchemaSet.class).getSchema(targetNamespace);

    BISchemaBinding sb =
        builder.getBindInfo(s).get(BISchemaBinding.class);
    if(sb!=null)    sb.markAsAcknowledged();

    String name = null;

    // "-p" takes precedence over everything else
    if( builder.defaultPackage1 != null )
        name = builder.defaultPackage1;

    // use the <jaxb:package> customization
    if( name == null && sb!=null && sb.getPackageName()!=null )
        name = sb.getPackageName();

    // the JAX-RPC option goes below the <jaxb:package>
    if( name == null && builder.defaultPackage2 != null )
        name = builder.defaultPackage2;

    // generate the package name from the targetNamespace
    if( name == null )
        name = builder.getNameConverter().toPackageName( targetNamespace );

    // hardcode a package name because the code doesn't compile
    // if it generated into the default java package
    if( name == null )
        name = "generated"; // the last resort


    // check if the package name is a valid name.
    if( checkedPackageNames.add(name) ) {
        // this is the first time we hear about this package name.
        if( !JJavaName.isJavaPackageName(name) )
            // TODO: s.getLocator() is not very helpful.
            // ideally, we'd like to use the locator where this package name
            // comes from.
            getErrorReporter().error(s.getLocator(),
                Messages.ERR_INCORRECT_PACKAGE_NAME, targetNamespace, name );
    }

    return Ring.get(JCodeModel.class)._package(name);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:53,代码来源:ClassSelector.java


示例7: buildCEnumConstants

import com.sun.codemodel.internal.JJavaName; //导入依赖的package包/类
/**
 *
 * @param errorRef
 *      if constant names couldn't be generated, return a reference to that enum facet.
 * @return
 *      null if unable to generate names for some of the constants.
 */
private List<CEnumConstant> buildCEnumConstants(XSRestrictionSimpleType type, boolean needsToGenerateMemberName, Map<String, BIEnumMember> members, XSFacet[] errorRef) {
    List<CEnumConstant> memberList = new ArrayList<CEnumConstant>();
    int idx=1;
    Set<String> enums = new HashSet<String>(); // to avoid duplicates. See issue #366

    for( XSFacet facet : type.getDeclaredFacets(XSFacet.FACET_ENUMERATION)) {
        String name=null;
        String mdoc=builder.getBindInfo(facet).getDocumentation();

        if(!enums.add(facet.getValue().value))
            continue;   // ignore the 2nd occasion

        if( needsToGenerateMemberName ) {
            // generate names for all member names.
            // this will even override names specified by the user. that's crazy.
            name = "VALUE_"+(idx++);
        } else {
            String facetValue = facet.getValue().value;
            BIEnumMember mem = members.get(facetValue);
            if( mem==null )
                // look at the one attached to the facet object
                mem = builder.getBindInfo(facet).get(BIEnumMember.class);

            if (mem!=null) {
                name = mem.name;
                if (mdoc == null) {
                    mdoc = mem.javadoc;
                }
            }

            if(name==null) {
                StringBuilder sb = new StringBuilder();
                for( int i=0; i<facetValue.length(); i++) {
                    char ch = facetValue.charAt(i);
                    if(Character.isJavaIdentifierPart(ch))
                        sb.append(ch);
                    else
                        sb.append('_');
                }
                name = model.getNameConverter().toConstantName(sb.toString());
            }
        }

        if(!JJavaName.isJavaIdentifier(name)) {
            if(errorRef!=null)  errorRef[0] = facet;
            return null;    // unable to generate a name
        }

        memberList.add(new CEnumConstant(name,mdoc,facet.getValue().value,facet,builder.getBindInfo(facet).toCustomizationList(),facet.getLocator()));
    }
    return memberList;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:60,代码来源:SimpleTypeBuilder.java


示例8: createClass

import com.sun.codemodel.internal.JJavaName; //导入依赖的package包/类
public JDefinedClass createClass(
    JClassContainer parent, int mod, String name, Locator source, ClassType kind ) {

    if(!JJavaName.isJavaIdentifier(name)) {
        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_INVALID_CLASSNAME, name ), source ));
        return createDummyClass(parent);
    }


    try {
        if(parent.isClass() && kind==ClassType.CLASS)
            mod |= JMod.STATIC;

        JDefinedClass r = parent._class(mod,name,kind);
        // use the metadata field to store the source location,
        // so that we can report class name collision errors.
        r.metadata = source;

        return r;
    } catch( JClassAlreadyExistsException e ) {
        // class collision.
        JDefinedClass cls = e.getExistingClass();

        // report the error
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION, cls.fullName() ),
            (Locator)cls.metadata ));
        errorReceiver.error( new SAXParseException(
            Messages.format( Messages.ERR_CLASSNAME_COLLISION_SOURCE, name ),
            source ));

        if( !name.equals(cls.name()) ) {
            // on Windows, FooBar and Foobar causes name collision
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CASE_SENSITIVITY_COLLISION,
                    name, cls.name() ), null ) );
        }

        if(Util.equals((Locator)cls.metadata,source)) {
            errorReceiver.error( new SAXParseException(
                Messages.format( Messages.ERR_CHAMELEON_SCHEMA_GONE_WILD ),
                source ));
        }

        return createDummyClass(parent);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:CodeModelClassFactory.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Tenant类代码示例发布时间:2022-05-23
下一篇:
Java SignatureHelp类代码示例发布时间: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