All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.eugene.models.object.xml.ObjectModelEnumerationImpl Maven / Gradle / Ivy

/*
 * #%L
 * EUGene :: EUGene
 * 
 * $Id: ObjectModelEnumerationImpl.java 1152 2012-06-01 10:51:04Z athimel $
 * $HeadURL: https://svn.nuiton.org/eugene/tags/eugene-2.11/eugene/src/main/java/org/nuiton/eugene/models/object/xml/ObjectModelEnumerationImpl.java $
 * %%
 * Copyright (C) 2004 - 2010 CodeLutin
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * .
 * #L%
 */

package org.nuiton.eugene.models.object.xml;

import com.google.common.collect.ImmutableSet;
import org.nuiton.eugene.models.object.ObjectModelEnumeration;
import org.nuiton.eugene.models.object.ObjectModelModifier;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;

/**
 * ObjectModelEnumerationImpl.
 *
 * Created: may 4th 2009
 *
 * @author Florian Desbois 
 * Copyright Code Lutin
 * @version $Revision: 1152 $
 *
 */
public class ObjectModelEnumerationImpl extends ObjectModelClassifierImpl
        implements ObjectModelEnumeration {

    /**
     * Collection of references corresponding to literal values
     */
    private Collection literalRefs = new ArrayList();

    /**
     * Add a literal to the ObjectModelEnumeration from Digester
     * @param ref corresponding to a Literal value
     */
    public void addLiteral(ObjectModelImplRef ref) {
        literalRefs.add(ref);
    }

    private static Set authorizedModifiers;

    @Override
    protected Set getAuthorizedModifiers() {
        if (authorizedModifiers == null) {
            // Nothing special ?
            authorizedModifiers = ImmutableSet.of();
        }
        return authorizedModifiers;
    }

    @Override
    public Collection getLiterals() {
        Collection results = new ArrayList();
        for (ObjectModelImplRef ref : literalRefs) {
            results.add(ref.getName());
        }
        return results;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy