001/*
002 * Copyright (c) 2006-2011 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 */
013
014package org.nuxeo.ecm.core.schema;
015
016import java.util.LinkedHashSet;
017import java.util.Set;
018
019import org.nuxeo.common.xmap.annotation.XNode;
020import org.nuxeo.common.xmap.annotation.XObject;
021
022/**
023 * Descriptor for a reference to a schema from a document type or a facet.
024 */
025@XObject("schema")
026public class SchemaDescriptor {
027
028    @XNode("@name")
029    public String name;
030
031    @XNode("@lazy")
032    public boolean isLazy = true;
033
034    public SchemaDescriptor() {
035    }
036
037    public SchemaDescriptor(String name) {
038        this.name = name;
039    }
040
041    public static Set<String> getSchemaNames(SchemaDescriptor[] sds) {
042        Set<String> set = new LinkedHashSet<String>();
043        for (SchemaDescriptor sd : sds) {
044            set.add(sd.name);
045        }
046        return set;
047    }
048
049}