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

Java NameConverter类代码示例

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

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java XRegistryKey类代码示例发布时间:2022-05-22
下一篇:
Java TrigMath类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap