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;
021
022import java.util.List;
023
024public interface Hierarchical {
025
026    /**
027     * Returns true if the <tt>subclasses()</tt> method will return an array of
028     * one or more elements (ie, not an empty array).
029     */
030    boolean hasSubclasses();
031
032    /**
033     * Get the list of specifications for all the interfaces that the class
034     * represented by this specification implements.
035     */
036    List<ObjectSpecification> interfaces();
037
038    /**
039     * Determines if this specification represents the same specification, or a
040     * subclass, of the specified specification.
041     * 
042     * <p>
043     * <tt>subSpec.isOfType(superSpec)</tt> is equivalent to
044     * {@link Class#isAssignableFrom(Class) Java's}
045     * <tt>superType.isAssignableFrom(subType)</tt>.
046     */
047    boolean isOfType(ObjectSpecification specification);
048
049    /**
050     * Get the list of specifications for the subclasses of the class
051     * represented by this specification
052     */
053    List<ObjectSpecification> subclasses();
054
055    /**
056     * Get the specification for this specification's class's superclass.
057     */
058    ObjectSpecification superclass();
059
060}