001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  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,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019
020package org.apache.isis.core.metamodel.spec.feature;
021
022import org.apache.isis.core.metamodel.facetapi.FeatureType;
023import org.apache.isis.core.metamodel.spec.ObjectSpecification;
024import org.apache.isis.core.metamodel.spec.Specification;
025
026/**
027 * A specification representing a non-{@link FeatureType#OBJECT object}, that
028 * therefore has an underlying type (the type of the property, collection)
029 * 
030 * <p>
031 * For a property or action parameter, is the type. For a collection is the
032 * element type. For an action it is always <tt>null</tt>.
033 */
034public interface ObjectFeature extends Specification {
035
036    /**
037     * Returns the identifier of the member, which must not change. This should
038     * be all camel-case with no spaces: so if the member is called 'Return
039     * Date' then a suitable id would be 'returnDate'.
040     */
041    String getId();
042
043    /**
044     * Return the name for this member - the field or action. This is based on
045     * the name of this member.
046     * 
047     * @see #getIdentifier()
048     */
049    String getName();
050
051    /**
052     * Returns a description of how the member is used - this complements the
053     * help text.
054     * 
055     * @see #getHelp()
056     */
057    @Override
058    String getDescription();
059
060    /**
061     * The specification of the underlying type.
062     * 
063     * <p>
064     * For example:
065     * <ul>
066     * <li>for a {@link OneToOneAssociation property}, will return the
067     * {@link ObjectSpecification} of the type that the accessor returns.
068     * <li>for a {@link OneToManyAssociation collection} it will be the type of
069     * element the collection holds (not the type of collection).
070     * <li>for a {@link ObjectAction action}, will always return <tt>null</tt>.
071     * See instead {@link ObjectAction#getReturnType()} and
072     * {@link ObjectAction#getParameterTypes()}.
073     * <li>for a {@link ObjectActionParameter action}, will return the type of
074     * the parameter}.
075     * </ul>
076     */
077    ObjectSpecification getSpecification();
078
079}