Class MetadataProxyFactory


  • public class MetadataProxyFactory
    extends Object
    A factory of metadata objects implemented by Java Proxy. The metadata values are specified by a Map of attributes in which keys are UML identifiers, and values must be assignable to the return value of the corresponding GeoAPI methods.

    Example: create an Individual instance:

    Map<String,Object> attributes = new HashMap<String,Object>();
    attributes.put("name", new SimpleInternationalString("Aristotle"));
    Individual party = factory.create(Individual.class, attributes);
    The metadata proxy are live, i.e. any change to the maps of attributes will be immediately reflected in the values returned by the metadata objects.
    Since:
    3.1
    • Constructor Detail

      • MetadataProxyFactory

        public MetadataProxyFactory()
        Creates a new factory.
    • Method Detail

      • create

        public <T> T create​(Class<T> type,
                            Map<String,​?> attributes)
                     throws IllegalArgumentException
        Creates a new implementation of the given metadata interface which will contains the values in the given map. The returned metadata proxy is live, i.e. any change to the given map of attributes will be immediately reflected in the values returned by the metadata object.
        Type Parameters:
        T - the compile-time type of the type argument.
        Parameters:
        type - the metadata interface for which to get an instance.
        attributes - the attribute values to give to the metadata instance.
        Returns:
        a metadata object which will fetch the values in the given map.
        Throws:
        IllegalArgumentException - if the given type is not an interface from the GeoAPI metadata package.