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
022/**
023 * A marker interface for schemas.
024 * <p>
025 * A schema is a complex type that can be used used to create composite types - such as document types.
026 * <p>
027 * Schemas have no super types and must not be used as field types.
028 */
029public interface Schema extends ComplexType {
030
031    /**
032     * Gets the types declared by this schema.
033     */
034    Type[] getTypes();
035
036    /**
037     * Gets a schema local type given its name.
038     *
039     * @param typeName
040     * @return the type or null if no such type
041     */
042    Type getType(String typeName);
043
044    /**
045     * Registers a new type in that schema context.
046     *
047     * @param type
048     */
049    void registerType(Type type);
050
051    /**
052     * @return true if the schema's fields are writable even for Version document.
053     * @since 8.4
054     */
055    default boolean isVersionWritabe() {
056        return false;
057    };
058
059}