001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2014-2023 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.parameter;
019
020import java.util.Optional;
021import org.opengis.annotation.UML;
022import org.opengis.util.ControlledVocabulary;
023
024import static org.opengis.annotation.Obligation.CONDITIONAL;
025import static org.opengis.annotation.Specification.ISO_19115;
026
027
028/**
029 * Class of information to which the referencing entity applies.
030 *
031 * @author  Rémi Maréchal (Geomatys)
032 * @version 3.1
033 * @since   3.1
034 */
035@UML(identifier="SV_ParameterDirection", specification=ISO_19115)
036public enum ParameterDirection implements ControlledVocabulary {
037    /**
038     * The parameter is an input parameter to the service instance.
039     */
040    @UML(identifier="in", obligation=CONDITIONAL, specification=ISO_19115)
041    IN("in"),
042
043    /**
044     * The parameter is an output parameter to the service instance.
045     */
046    @UML(identifier="out", obligation=CONDITIONAL, specification=ISO_19115)
047    OUT("out"),
048
049    /**
050     * The parameter is both an input and output parameter to the service instance.
051     */
052    @UML(identifier="in/out", obligation=CONDITIONAL, specification=ISO_19115)
053    IN_OUT("in/out");
054
055    /**
056     * The UML identifier.
057     */
058    private final String identifier;
059
060    /**
061     * Creates a new constant with the given UML identifier.
062     *
063     * @param identifier  the UML identifier.
064     */
065    private ParameterDirection(final String identifier) {
066        this.identifier = identifier;
067    }
068
069    /**
070     * Returns the UML identifier for this enumeration constant.
071     *
072     * @since 3.1
073     */
074    @Override
075    public Optional<String> identifier() {
076        return Optional.ofNullable(identifier);
077    }
078
079    /**
080     * Returns all constants defined by this enumeration type.
081     * Invoking this method is equivalent to invoking {@link #values()}, except that this
082     * method can be invoked on an instance of the {@code ControlledVocabulary} interface
083     * (i.e. the enumeration type does not need to be known at compile-time).
084     *
085     * @return all {@linkplain #values() values} for this enumeration.
086     */
087    @Override
088    public ParameterDirection[] family() {
089        return values();
090    }
091}