001/*
002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Bogdan Stefanescu
018 *     Florent Guillaume
019 */
020package org.nuxeo.ecm.core.schema.types;
021
022import java.util.Collection;
023
024/**
025 * A composite type is an aggregation of several schemas.
026 * <p>
027 * Each schema defines its own namespace to avoid field name collisions.
028 */
029public interface CompositeType extends ComplexType {
030
031    /**
032     * Gets the composite type schema given its name.
033     *
034     * @param name the schema name
035     * @return the schema if any or null if none was found
036     */
037    Schema getSchema(String name);
038
039    /**
040     * Checks if this composite type has any schema defined.
041     *
042     * @return true if this composite type has some schemas defined, false otherwise
043     */
044    boolean hasSchemas();
045
046    /**
047     * Checks if this composite type has the given schema.
048     *
049     * @param name the schema name
050     * @return true if the composite type has this schema, false otherwise
051     */
052    boolean hasSchema(String name);
053
054    /**
055     * Gets the schema names of this type.
056     *
057     * @return the schema names
058     */
059    String[] getSchemaNames();
060
061    /**
062     * Gets all the schemas (including inherited schemas) of this composite type.
063     *
064     * @return the composite type schemas
065     */
066    Collection<Schema> getSchemas();
067
068}