GedcomNamespaceManager.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:gedcomx-java 作者:
/**
 * Get the id for the specified type.
 *
 * @param type The type.
 * @return The type id.
 */
public static String getTypeIdName(Class<?> type) {
  String ns = "";
  if (type.getPackage() != null && type.getPackage().isAnnotationPresent(XmlSchema.class)) {
    ns = type.getPackage().getAnnotation(XmlSchema.class).namespace();
  }

  String name = Introspector.decapitalize(type.getSimpleName());
  if (type.isAnnotationPresent(XmlType.class)) {
    XmlType typeMeta = type.getAnnotation(XmlType.class);
    if (!"##default".equals(typeMeta.name())) {
      name = typeMeta.name();
    }

    if (!"##default".equals(typeMeta.namespace())) {
      ns = typeMeta.namespace();
    }
  }

  return ns + name;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号