本文整理汇总了Java中com.sun.tools.internal.xjc.model.CEnumConstant类的典型用法代码示例。如果您正苦于以下问题:Java CEnumConstant类的具体用法?Java CEnumConstant怎么用?Java CEnumConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CEnumConstant类属于com.sun.tools.internal.xjc.model包,在下文中一共展示了CEnumConstant类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkMemberNameCollision
import com.sun.tools.internal.xjc.model.CEnumConstant; //导入依赖的package包/类
/**
* Returns non-null if {@link CEnumConstant}s have name collisions among them.
*
* @return
* if there's a collision, return two {@link CEnumConstant}s that collided.
* otherwise return null.
*/
private CEnumConstant[] checkMemberNameCollision( List<CEnumConstant> memberList ) {
Map<String,CEnumConstant> names = new HashMap<String,CEnumConstant>();
for (CEnumConstant c : memberList) {
CEnumConstant old = names.put(c.getName(),c);
if(old!=null)
// collision detected
return new CEnumConstant[]{old,c};
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SimpleTypeBuilder.java
示例2: buildMemberList
import com.sun.tools.internal.xjc.model.CEnumConstant; //导入依赖的package包/类
private static List<CEnumConstant> buildMemberList( Model model, Element dom ) {
List<CEnumConstant> r = new ArrayList<CEnumConstant>();
String members = DOMUtil.getAttribute(dom,"members");
if(members==null) members=""; // TODO: error handling
StringTokenizer tokens = new StringTokenizer(members);
while(tokens.hasMoreTokens()) {
String token = tokens.nextToken();
r.add(new CEnumConstant(model.getNameConverter().toConstantName(token),
null,token,null/*TODO*/,null,null));
}
return r;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:BIEnumeration.java
示例3: EnumConstantOutline
import com.sun.tools.internal.xjc.model.CEnumConstant; //导入依赖的package包/类
/**
* Reserved for {@link BeanGenerator}.
*/
protected EnumConstantOutline(CEnumConstant target, JEnumConstant constRef) {
this.target = target;
this.constRef = constRef;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:EnumConstantOutline.java
示例4: buildCEnumConstants
import com.sun.tools.internal.xjc.model.CEnumConstant; //导入依赖的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
示例5: buildCEnumConstants
import com.sun.tools.internal.xjc.model.CEnumConstant; //导入依赖的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:alexkasko,项目名称:openjdk-icedtea7,代码行数:60,代码来源:SimpleTypeBuilder.java
注:本文中的com.sun.tools.internal.xjc.model.CEnumConstant类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论