Search in sources :

Example 1 with PropertyTypeBuilder

use of org.apache.sis.feature.builder.PropertyTypeBuilder in project sis by apache.

the class Types method create.

/**
 * Adds internationalized designation and definition information for all properties in the given type.
 * Then, returns the result of {@link FeatureTypeBuilder#build()}.
 *
 * @param  builder   the feature type builder for which to add designations and definitions.
 * @param  previous  previously created international strings as array of length 2.
 *                   The first element is the designation and the second element is the definition.
 */
private static DefaultFeatureType create(final FeatureTypeBuilder builder, final Map<String, InternationalString[]> previous) {
    for (final PropertyTypeBuilder p : builder.properties()) {
        final GenericName name = p.getName();
        if (!AttributeConvention.contains(name)) {
            final InternationalString[] resources = previous.computeIfAbsent(name.toString(), (key) -> new InternationalString[] { new ResourceInternationalString("org.apache.sis.internal.storage.gpx.Designations", key), new ResourceInternationalString("org.apache.sis.internal.storage.gpx.Definitions", key) });
            p.setDefinition(resources[1]);
            p.setDesignation(resources[0]);
        }
    }
    return builder.build();
}
Also used : PropertyTypeBuilder(org.apache.sis.feature.builder.PropertyTypeBuilder) GenericName(org.opengis.util.GenericName) ResourceInternationalString(org.apache.sis.util.iso.ResourceInternationalString) InternationalString(org.opengis.util.InternationalString) ResourceInternationalString(org.apache.sis.util.iso.ResourceInternationalString)

Aggregations

PropertyTypeBuilder (org.apache.sis.feature.builder.PropertyTypeBuilder)1 ResourceInternationalString (org.apache.sis.util.iso.ResourceInternationalString)1 GenericName (org.opengis.util.GenericName)1 InternationalString (org.opengis.util.InternationalString)1