本文整理汇总了Java中com.sun.xml.bind.api.impl.NameConverter类的典型用法代码示例。如果您正苦于以下问题:Java NameConverter类的具体用法?Java NameConverter怎么用?Java NameConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NameConverter类属于com.sun.xml.bind.api.impl包,在下文中一共展示了NameConverter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAttributeAnnotation
import com.sun.xml.bind.api.impl.NameConverter; //导入依赖的package包/类
private static AttributeAnnotation getAttributeAnnotation(ClassOutline parent, CPropertyInfo prop) {
CAttributePropertyInfo ap = (CAttributePropertyInfo) prop;
QName attName = ap.getXmlName();
AttributeAnnotation attributeAnnotation = new AttributeAnnotation();
final String generatedName = attName.getLocalPart();
// Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
// generate name property?
if(!generatedName.equals(ap.getName(false)) || (parent.parent().getModel().getNameConverter() != NameConverter.standard)) {
attributeAnnotation.setName(generatedName);
}
return attributeAnnotation;
}
开发者ID:agodet,项目名称:wadlcodegenerator,代码行数:17,代码来源:ClassModelBuilder.java
示例2: getAttributeAnnotation
import com.sun.xml.bind.api.impl.NameConverter; //导入依赖的package包/类
private static AttributeAnnotation getAttributeAnnotation(ClassOutline parent, CPropertyInfo prop) {
CAttributePropertyInfo ap = (CAttributePropertyInfo) prop;
QName attName = ap.getXmlName();
AttributeAnnotation attributeAnnotation = new AttributeAnnotation();
final String generatedName = attName.getLocalPart();
// Issue 570; always force generating name="" when do it when globalBindings underscoreBinding is set to non default value
// generate name property?
if(!generatedName.equals(ap.getName(false)) || (parent.parent().getModel().getNameConverter() != NameConverter.standard)) {
attributeAnnotation.setName(generatedName);
}
return attributeAnnotation;
}
开发者ID:bulldog2011,项目名称:mxjc,代码行数:17,代码来源:ClassModelBuilder.java
示例3: generateAccessors
import com.sun.xml.bind.api.impl.NameConverter; //导入依赖的package包/类
@Override
public void generateAccessors() {
final MethodWriter writer = outline.createMethodWriter();
final Accessor acc = create(JExpr._this());
// [RESULT]
// List getXXX() {
// return <ref>;
// }
$get = writer.declareMethod(listT,"get"+prop.getName(true));
writer.javadoc().append(prop.javadoc);
JBlock block = $get.body();
fixNullRef(block); // avoid using an internal getter
block._return(acc.ref(true));
String pname = NameConverter.standard.toVariableName(prop.getName(true));
writer.javadoc().append(
"Gets the value of the "+pname+" property.\n\n"+
"<p>\n" +
"This accessor method returns a reference to the live list,\n" +
"not a snapshot. Therefore any modification you make to the\n" +
"returned list will be present inside the JAXB object.\n" +
"This is why there is not a <CODE>set</CODE> method for the " +pname+ " property.\n" +
"\n"+
"<p>\n" +
"For example, to add a new item, do as follows:\n"+
"<pre>\n"+
" get"+prop.getName(true)+"().add(newItem);\n"+
"</pre>\n"+
"\n\n"
);
writer.javadoc().append(
"<p>\n" +
"Objects of the following type(s) are allowed in the list\n")
.append(listPossibleTypes(prop));
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:38,代码来源:UntypedListField.java
示例4: getTypeName
import com.sun.xml.bind.api.impl.NameConverter; //导入依赖的package包/类
public static QName getTypeName(Class<?> targetClass) {
Validate.notNull(targetClass);
final Package targetPackage = targetClass.getPackage();
final XmlType xmlTypeAnnotation = targetClass
.getAnnotation(XmlType.class);
final String localPart;
final String namespaceURI;
final String prefix;
if (xmlTypeAnnotation == null) {
localPart = NameConverter.standard.toVariableName(targetClass
.getSimpleName());
namespaceURI = getNamespace(targetPackage);
} else {
final String name = xmlTypeAnnotation.name();
if (name == null || "".equals(name)) {
localPart = null;
} else {
if ("##default".equals(name)) {
localPart = NameConverter.standard
.toVariableName(targetClass.getSimpleName());
} else {
localPart = name;
}
}
final String namespace = xmlTypeAnnotation.namespace();
if (namespace == null || "".equals(namespace)) {
namespaceURI = "";
} else {
if ("##default".equals(namespace)) {
namespaceURI = getNamespace(targetPackage);
} else {
namespaceURI = namespace;
}
}
}
if (localPart == null) {
return null;
} else {
prefix = getPrefix(targetPackage, namespaceURI);
}
return prefix == null ? new QName(namespaceURI, localPart) : new QName(
namespaceURI, localPart, prefix);
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:50,代码来源:XmlTypeUtils.java
示例5: getPropertyName
import com.sun.xml.bind.api.impl.NameConverter; //导入依赖的package包/类
public static String getPropertyName(FieldOutline fieldOutline) {
return NameConverter.standard.toVariableName(fieldOutline
.getPropertyInfo().getName(true));
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:5,代码来源:OutlineUtils.java
示例6: getPropertyName
import com.sun.xml.bind.api.impl.NameConverter; //导入依赖的package包/类
public String getPropertyName(Mapping context, FieldOutline fieldOutline) {
return NameConverter.standard.toVariableName(fieldOutline
.getPropertyInfo().getName(true));
}
开发者ID:highsource,项目名称:hyperjaxb3,代码行数:5,代码来源:DefaultNaming.java
注:本文中的com.sun.xml.bind.api.impl.NameConverter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论