/** * Maps method names to the name of columns in the database table corresponding to the current * {@linkplain #getMetadataType() metadata type}. The values in the returned map must be the * same than the keys in the map returned by {@link MetadataSource#asValueMap(Object)}. * * @throws ClassCastException if the metadata object type does not extend a metadata interface * of the expected package. */ @SuppressWarnings("ReturnOfCollectionOrArrayField") final Map<String,String> asNameMap(final MetadataStandard standard) { if (names == null) { names = standard.asNameMap(type, KeyNamePolicy.METHOD_NAME, MetadataSource.NAME_POLICY); } return names; }
/** * Maps method names to the name of columns in the database table corresponding to the current * {@linkplain #getMetadataType() metadata type}. The values in the returned map must be the * same than the keys in the map returned by {@link MetadataSource#asValueMap(Object)}. * * @throws ClassCastException if the metadata object type does not extend a metadata interface * of the expected package. */ @SuppressWarnings("ReturnOfCollectionOrArrayField") final Map<String,String> asNameMap(final MetadataStandard standard) { if (names == null) { names = standard.asNameMap(type, KeyNamePolicy.METHOD_NAME, MetadataSource.NAME_POLICY); } return names; }
final Map<String,String> map = MetadataStandard.ISO_19115.asNameMap( Citation.class, KeyNamePolicy.UML_IDENTIFIER, KeyNamePolicy.JAVABEANS_PROPERTY); assertArrayEquals(new Object[] {
/** * Tests the formatting of sentences. */ @Test public void testSentences() { final Map<String,String> map, expected = new HashMap<>(); map = MetadataStandard.ISO_19115.asNameMap(EnvironmentalRecord.class, JAVABEANS_PROPERTY, SENTENCE); assertNull(expected.put("averageAirTemperature", "Average air temperature")); assertNull(expected.put("maxAltitude", "Max altitude")); assertNull(expected.put("maxRelativeHumidity", "Max relative humidity")); assertNull(expected.put("meteorologicalConditions", "Meteorological conditions")); assertEquals(expected, map); }
final LookupInfo info = getLookupInfo(subType); final Map<String,Object> map = asValueMap(value); final Map<String,String> methods = standard.asNameMap(subType, NAME_POLICY, KeyNamePolicy.METHOD_NAME); for (final Map.Entry<String,Object> entry : map.entrySet()) { method = subType.getMethod(methods.get(entry.getKey()));
final LookupInfo info = getLookupInfo(subType); final Map<String,Object> map = asValueMap(value); final Map<String,String> methods = standard.asNameMap(subType, NAME_POLICY, KeyNamePolicy.METHOD_NAME); for (final Map.Entry<String,Object> entry : map.entrySet()) { method = subType.getMethod(methods.get(entry.getKey()));
map = MetadataStandard.ISO_19115.asNameMap(EnvironmentalRecord.class, SENTENCE, JAVABEANS_PROPERTY); name = map.get("Average air temperature"); assertEquals("averageAirTemperature", name); map = MetadataStandard.ISO_19115.asNameMap(EnvironmentalRecord.class, SENTENCE, METHOD_NAME); name = map.get("Average air temperature"); assertEquals("getAverageAirTemperature", name); map = MetadataStandard.ISO_19115.asNameMap(EnvironmentalRecord.class, SENTENCE, UML_IDENTIFIER); name = map.get("Average air temperature"); assertEquals("averageAirTemperature", name);
final String name = method.getName(); if (names == null) { names = standard.asNameMap(type, KeyNamePolicy.JAVABEANS_PROPERTY, KeyNamePolicy.METHOD_NAME);