org.opengis.annotation.UML.identifier()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.2k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中org.opengis.annotation.UML.identifier()方法的一些代码示例,展示了UML.identifier()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UML.identifier()方法的具体详情如下:
包路径:org.opengis.annotation.UML
类名称:UML
方法名:identifier

UML.identifier介绍

暂无

代码示例

代码示例来源:origin: geotools/geotools

final UML annotation = field.getAnnotation(UML.class);
if (annotation != null) {
  identifier = annotation.identifier();

代码示例来源:origin: geotools/geotools

final UML annotation = getter.getAnnotation(UML.class);
if (annotation != null) {
  addMapping(annotation.identifier(), index);

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns the {@code identifier()} value of the given annotation or {@code null} if none or empty.
 */
private static String identifier(final UML uml) {
  if (uml != null) {
    final String id = uml.identifier();
    if (!id.isEmpty()) return id;
  }
  return null;
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns {@code true} if the given property shall be ignored.
 */
private boolean isIgnored(final Class<?> type, final UML property) {
  final Set<String> properties = ignore.get(type);
  return (properties != null) && properties.contains(property.identifier());
}

代码示例来源:origin: org.apache.sis.core/sis-metadata

/**
 * Returns the table name for the specified class.
 * This is usually the ISO 19115 name.
 */
static String getTableName(final Class<?> type) {
  final UML annotation = type.getAnnotation(UML.class);
  if (annotation == null) {
    return type.getSimpleName();
  }
  final String name = annotation.identifier();
  return name.substring(name.lastIndexOf('.') + 1);
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns a string representation for this metadata handler. This method format the
 * ISO/OGC identifier of the metadata type followed by the string representation of
 * the attributes map.
 */
@Override
public String toString() {
  String name = null;
  final UML uml = type.getAnnotation(UML.class);
  if (uml != null) {
    name = uml.identifier();
  }
  if (name == null || ((name.trim()).isEmpty())) {
    name = type.getSimpleName();
  }
  return name + attributes;
}

代码示例来源:origin: org.geotoolkit/geotk-metadata

/**
 * Creates a description map for the specified accessor.
 *
 * @param  accessor    The accessor to use for the metadata.
 * @param  packageBase The base package of interfaces. Must end with {@code '.'}.
 * @param  locale      Determines the locale of values in this map.
 * @param  keyNames    Determines the string representation of keys in the map.
 * @throws MissingResourceException If no resource bundle is found.
 */
DescriptionMap(final PropertyAccessor accessor, final String packageBase,
    final Locale locale, final KeyNamePolicy keyNames) throws MissingResourceException
{
  super(accessor, keyNames);
  final Class<?> type = accessor.type;
  final UML uml = type.getAnnotation(UML.class);
  classname = (uml != null) ? uml.identifier() : type.getSimpleName();
  descriptions = ResourceBundle.getBundle(packageBase + "Descriptions", locale);
}

代码示例来源:origin: apache/sis

final UML uml = type.getAnnotation(UML.class);
if (uml != null) {
  final String id = uml.identifier();
  if (id != null && !id.isEmpty()) {

代码示例来源:origin: apache/sis

/**
 * Returns the table name for the specified class. This is usually the ISO 19115 name,
 * but we fallback on the simple class name if the ISO name is not available.
 * The package prefix is omitted (e.g. {@code "CI_"} in {@code "CI_Citation"}
 * since newer ISO standards tend to drop it.
 */
static String getTableName(final Class<?> type) {
  final UML annotation = type.getAnnotation(UML.class);
  if (annotation == null) {
    return type.getSimpleName();
  }
  final String name = annotation.identifier();
  int s = name.lastIndexOf('.') + 1;
  /*
   * Drop package prefix if present (e.g. "CI_" in "CI_Citation").
   */
  if (name.length() > s+3 && name.charAt(s+2) == '_' && Character.isUpperCase(name.charAt(1))) {
    s += 3;
  }
  return name.substring(s);
}

代码示例来源:origin: org.geotoolkit/geotk-metadata

/**
 * Returns the resource key for the given property index.
 */
final String key(final int index) {
  String base = classname;
  final Class<?> decl = accessor.getDeclaringClass(index);
  if (decl != null) {
    final UML uml = decl.getAnnotation(UML.class);
    base = (uml != null) ? uml.identifier() : decl.getSimpleName();
  }
  return base + '.' + accessor.name(index, KeyNamePolicy.UML_IDENTIFIER);
}

代码示例来源:origin: org.geotoolkit/geotk-metadata

/**
 * Compares the given methods for order.
 */
@Override
public int compare(final Method m1, final Method m2) {
  final UML a1 = m1.getAnnotation(UML.class);
  final UML a2 = m2.getAnnotation(UML.class);
  if (a1 != null) {
    if (a2 == null) return +1;       // Sort annotated elements first.
    int c = order(a1) - order(a2);   // Mandatory elements must be first.
    if (c == 0) {
      // Fallback on alphabetical order.
      c = a1.identifier().compareToIgnoreCase(a2.identifier());
    }
    return c;
  } else if (a2 != null) {
    return -1; // Sort annotated elements first.
  }
  // Fallback on alphabetical order.
  return m1.getName().compareToIgnoreCase(m2.getName());
}

代码示例来源:origin: org.geotoolkit/geotk-metadata

final UML uml = getters[index].getAnnotation(UML.class);
if (uml != null) {
  return uml.identifier();

代码示例来源:origin: apache/sis

if (uml == null || (index = order.get(uml.identifier())) == null) {
  index = -1;

代码示例来源:origin: apache/sis

/**
 * Returns the title of the given enumeration or code list value.
 *
 * @param  code    the code for which to get the title.
 * @param  locale  desired locale for the title.
 * @return the title.
 *
 * @see org.apache.sis.util.iso.Types#getCodeTitle(CodeList)
 */
public String getCodeTitle(final CodeList<?> code, final Locale locale) {
  /*
   * Following code reproduces the work done by org.apache.sis.util.iso.Types.getCodeList(…)
   * with less handling of special cases. It is executed only if the sis-metadata module is
   * not on the classpath, otherwise the sis-metadata implementation will be used.
   */
  final UML uml = code.getClass().getAnnotation(UML.class);
  if (uml != null) try {
    return ResourceBundle.getBundle(CodeLists.RESOURCES, locale, UML.class.getClassLoader())
               .getString(uml.identifier() + '.' + code.identifier());
  } catch (MissingResourceException e) {
    /*
     * Ignore. The reason for not finding the resource may because of above code not covering enough cases.
     * Usually the sis-metadata module will be present on the classpath, in which case this implementation
     * will not be used. We need just enough code for allowing sis-utility tests to pass.
     */
  }
  return CharSequences.camelCaseToSentence(code.identifier()).toString();
}

代码示例来源:origin: apache/sis

/**
 * Returns the name of the XML root element for an interface described by the given UML.
 * The default implementation returns {@link UML#identifier()}, possibly with {@code "Abstract"} prepended.
 * Subclasses shall override this method when mismatches are known to exist between the UML and XML element names.
 *
 * @param  uml  the UML of the interface for which to get the corresponding XML root element name.
 * @return the name of the XML root element for the given UML.
 *
 * @see #testImplementationAnnotations()
 *
 * @deprecated the complete function is available only on development branch because it depends on GeoAPI 3.1.
 */
@Deprecated
protected String getExpectedXmlRootElementName(final UML uml) {
  String name = uml.identifier();
  switch (name) {
    // This case can be removed if https://issues.apache.org/jira/browse/SIS-398 is fixed.
    case "MI_PolarizationOrientationCode": name = "MI_PolarisationOrientationCode"; break;
  }
  return name;
}

代码示例来源:origin: org.apache.sis.core/sis-metadata

/**
 * Compares the given methods for order.
 */
@Override
public int compare(final Method m1, final Method m2) {
  final boolean deprecated = isDeprecated(implementation, m1);
  if (deprecated != isDeprecated(implementation, m2)) {
    return deprecated ? +1 : -1;
  }
  int c = indexOf(m2) - indexOf(m1);                          // indexOf(…) are sorted in descending order.
  if (c == 0) {
    final UML a1 = m1.getAnnotation(UML.class);
    final UML a2 = m2.getAnnotation(UML.class);
    if (a1 != null) {
      if (a2 == null) return +1;                          // Sort annotated elements first.
      c = order(a1) - order(a2);                          // Mandatory elements must be first.
      if (c == 0) {
        // Fallback on alphabetical order.
        c = a1.identifier().compareToIgnoreCase(a2.identifier());
      }
      return c;
    } else if (a2 != null) {
      return -1;                                          // Sort annotated elements first.
    }
    c = m1.getName().compareToIgnoreCase(m2.getName());     // Fallback on alphabetical order.
  }
  return c;
}

代码示例来源:origin: apache/sis

/**
 * Compares the given methods for order.
 */
@Override
public int compare(final Method m1, final Method m2) {
  final boolean deprecated = isDeprecated(implementation, m1);
  if (deprecated != isDeprecated(implementation, m2)) {
    return deprecated ? +1 : -1;
  }
  int c = indexOf(m2) - indexOf(m1);                          // indexOf(…) are sorted in descending order.
  if (c == 0) {
    final UML a1 = m1.getAnnotation(UML.class);
    final UML a2 = m2.getAnnotation(UML.class);
    if (a1 != null) {
      if (a2 == null) return +1;                          // Sort annotated elements first.
      c = order(a1) - order(a2);                          // Mandatory elements must be first.
      if (c == 0) {
        // Fallback on alphabetical order.
        c = a1.identifier().compareToIgnoreCase(a2.identifier());
      }
      return c;
    } else if (a2 != null) {
      return -1;                                          // Sort annotated elements first.
    }
    c = m1.getName().compareToIgnoreCase(m2.getName());     // Fallback on alphabetical order.
  }
  return c;
}

代码示例来源:origin: opengeospatial/geoapi

/**
 * Returns the type definitions for the given class. This convenience method compute a XML name from
 * the annotations attached to the given type, then delegates to {@link #getTypeDefinition(String)}.
 *
 * @param  type  the GeoAPI interface (e.g. {@link org.opengis.metadata.Metadata}), or {@code null}.
 * @return all properties for the given class in declaration order, or {@code null} if unknown.
 */
public Map<String,Element> getTypeDefinition(final Class<?> type) {
  if (type != null) {
    final UML uml = type.getAnnotation(UML.class);
    if (uml != null) {
      final Classifier c = type.getAnnotation(Classifier.class);
      boolean applySpellingChange = false;
      do {                                                // Will be executed 1 or 2 times only.
        String name = uml.identifier();
        if (applySpellingChange) {
          name = departures.spellingChanges.get(name);
          if (name == null) break;
        }
        if (c != null && Stereotype.ABSTRACT.equals(c.value())) {
          name = "Abstract" + name;
        }
        Map<String,Element> def = getTypeDefinition(name);
        if (def != null) return def;
      } while ((applySpellingChange = !applySpellingChange));
    }
  }
  return null;
}

代码示例来源:origin: apache/sis

/**
 * Returns the name of the XML type for an interface described by the given UML.
 * For example in ISO 19115-3, the XML type of {@code CI_Citation} is {@code CI_Citation_Type}.
 * The default implementation returns {@link UML#identifier()}, possibly with {@code "Abstract"} prepended,
 * and unconditionally with {@code "_Type"} appended.
 * Subclasses shall override this method when mismatches are known to exist between the UML and XML type names.
 *
 * @param  uml  the UML of the interface for which to get the corresponding XML type name.
 * @return the name of the XML type for the given element, or {@code null} if none.
 *
 * @see #testImplementationAnnotations()
 *
 * @deprecated the complete function is available only on development branch because it depends on GeoAPI 3.1.
 */
@Deprecated
protected String getExpectedXmlTypeName(final UML uml) {
  final String rootName = uml.identifier();
  final StringBuilder buffer = new StringBuilder(rootName.length() + 13);
  return buffer.append(rootName).append("_Type").toString();
}

代码示例来源:origin: apache/sis

'.' + type.getAnnotation(UML.class).identifier();
final Class<?> wrapper = Class.forName(classname);

相关文章