001/*
002 * Copyright (c) 2006-2012 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Bogdan Stefanescu
011 *     Florent Guillaume
012 */
013package org.nuxeo.ecm.core.schema.types;
014
015import java.util.Collection;
016
017/**
018 * A composite type is an aggregation of several schemas.
019 * <p>
020 * Each schema defines its own namespace to avoid field name collisions.
021 */
022public interface CompositeType extends ComplexType {
023
024    /**
025     * Gets the composite type schema given its name.
026     *
027     * @param name the schema name
028     * @return the schema if any or null if none was found
029     */
030    Schema getSchema(String name);
031
032    /**
033     * Checks if this composite type has any schema defined.
034     *
035     * @return true if this composite type has some schemas defined, false otherwise
036     */
037    boolean hasSchemas();
038
039    /**
040     * Checks if this composite type has the given schema.
041     *
042     * @param name the schema name
043     * @return true if the composite type has this schema, false otherwise
044     */
045    boolean hasSchema(String name);
046
047    /**
048     * Gets the schema names of this type.
049     *
050     * @return the schema names
051     */
052    String[] getSchemaNames();
053
054    /**
055     * Gets all the schemas (including inherited schemas) of this composite type.
056     *
057     * @return the composite type schemas
058     */
059    Collection<Schema> getSchemas();
060
061}