001// Copyright 2004, 2005 The Apache Software Foundation
002//
003// Licensed under the Apache License, Version 2.0 (the "License");
004// you may not use this file except in compliance with the License.
005// You may obtain a copy of the License at
006//
007//     http://www.apache.org/licenses/LICENSE-2.0
008//
009// Unless required by applicable law or agreed to in writing, software
010// distributed under the License is distributed on an "AS IS" BASIS,
011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012// See the License for the specific language governing permissions and
013// limitations under the License.
014
015package org.apache.hivemind.schema;
016
017import java.util.List;
018
019import org.apache.hivemind.Locatable;
020import org.apache.hivemind.parse.AnnotationHolder;
021
022/**
023 * Identifies an element that may occur within some schema. Because elements may be nested, an
024 * ElementModel is also a {@link org.apache.hivemind.schema.Schema}.
025 * 
026 * @author Howard Lewis Ship
027 */
028public interface ElementModel extends AnnotationHolder, Locatable
029{
030    /**
031     * Returns the name of the element.
032     */
033    public String getElementName();
034
035    /**
036     * Returns a List of {@link ElementModel}, identifing the elements which may be enclosed by the
037     * modeled element.
038     * <p>
039     * The returned list is unmodifiabled and may be empty, but won't be null.
040     */
041    public List getElementModel();
042
043    /**
044     * Returns a List of {@link AttributeModel}s. The List is unmodifiable and won't be null, but
045     * may be empty.
046     */
047    public List getAttributeModels();
048
049    public AttributeModel getAttributeModel(String name);
050
051    /**
052     * Returns the name of the attribute whose value can be used as a key for an instance of an
053     * Element with this ElementModel. This key is usually used to index a configuration
054     * contribution inside a Map.
055     * 
056     * @since 1.1
057     */
058    public String getKeyAttribute();
059
060    /**
061     * Returns a List of {@link org.apache.hivemind.schema.Rule}. The List is unmodifiable and
062     * won't but null, but could be empty.
063     */
064    public List getRules();
065
066    /**
067     * Returns the translator used for character content within the body of the element; may return
068     * null.
069     */
070    public String getContentTranslator();
071
072}