001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2006-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.feature;
019
020import org.opengis.util.GenericName;
021
022
023/**
024 * An instance of a {@link PropertyType}.
025 * A property is usually part of another entity such as a {@link Feature}.
026 * This interface is the parent type of {@linkplain Attribute attribute} and
027 * {@linkplain FeatureAssociation feature association} but not feature.
028 *
029 * <p>A property is a wrapper around an arbitrary object or value.
030 * It provides the following information:</p>
031 *
032 * <ul>
033 *   <li>A value, available via the {@link #getValue()} method.
034 *       The value can be set via a setter method provided by the sub-interface.</li>
035 *   <li>A type, available via the {@code getType()} or {@code getRole()} method provided by the sub-interface.
036 *       The {@link PropertyType} defines information about the property.
037 *       This includes which Java class the value of the property is an instance of, any restrictions on
038 *       the value, <i>etc</i>.</li>
039 * </ul>
040 *
041 * @author  Jody Garnett (Refractions Research, Inc.)
042 * @author  Justin Deoliveira (The Open Planning Project)
043 * @author  Martin Desruisseaux (Geomatys)
044 * @version 3.1
045 * @since   3.1
046 */
047public interface Property {
048    /**
049     * Returns the name of this property.
050     * This is a convenience method for {@code getType().getName()} or
051     * {@code getRole().getName()}, depending on the sub-interface.
052     *
053     * @return name of this property.
054     */
055    GenericName getName();
056
057    /**
058     * Returns the value or content of the property, or {@code null} if none.
059     * <ul>
060     *   <li>If this property is an {@link Attribute}, then the returned object may be an instance of any Java class
061     *       assignable to {@link AttributeType#getValueClass()}.</li>
062     *   <li>If this property is an {@link FeatureAssociation}, then the returned object is a {@link Feature}.</li>
063     * </ul>
064     *
065     * @return the value of the property, or {@code null} if none.
066     */
067    Object getValue();
068}