本文整理汇总了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;
}
示例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;
}
示例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));
}
示例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);
}
示例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));
}
示例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));
}