Package org.andromda.metafacades.uml14

Source Code of org.andromda.metafacades.uml14.TaggedValueFacadeLogicImpl

package org.andromda.metafacades.uml14;

import org.apache.commons.lang.StringUtils;
import org.omg.uml.foundation.core.TagDefinition;

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

/**
* Metaclass facade implementation.
*/
public class TaggedValueFacadeLogicImpl
        extends TaggedValueFacadeLogic
{
    public TaggedValueFacadeLogicImpl(org.omg.uml.foundation.core.TaggedValue metaObject, String context)
    {
        super(metaObject, context);
    }

    /**
     * @see org.andromda.metafacades.uml14.ModelElementFacadeLogic#handleGetName()
     */
    public String handleGetName()
    {
        String name = super.handleGetName();
        if (StringUtils.isEmpty(name))
        {
            final TagDefinition type = this.metaObject.getType();
            if (type != null)
            {
                name = type.getName();
                // sometimes it is the TagType
                if (StringUtils.isEmpty(name))
                {
                    name = type.getTagType();
                }
            }
        }
        return name;
    }

    /**
     * @see org.andromda.metafacades.uml.TaggedValueFacade#getValues()
     */
    public Collection handleGetValues()
    {
        final Collection values = new ArrayList();
        values.addAll(metaObject.getDataValue());
        values.addAll(this.shieldedElements(metaObject.getReferenceValue()));
        return values;
    }

    /**
     * @see org.andromda.metafacades.uml.TaggedValueFacade#getValue()
     */
    public java.lang.Object handleGetValue()
    {
        final Collection values = this.getValues();
        return (values.isEmpty()) ? null : values.iterator().next();
    }

}
TOP

Related Classes of org.andromda.metafacades.uml14.TaggedValueFacadeLogicImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.