001package org.andromda.cartridges.ejb3.metafacades;
002
003import java.util.Collection;
004import org.andromda.metafacades.uml.AttributeFacade;
005
006/**
007 * MetafacadeLogic implementation for org.andromda.cartridges.ejb3.metafacades.EJB3EnumerationFacade.
008 *
009 * @see EJB3EnumerationFacade
010 */
011public class EJB3EnumerationFacadeLogicImpl
012    extends EJB3EnumerationFacadeLogic
013{
014    private static final long serialVersionUID = 34L;
015    /**
016     * @param metaObject
017     * @param context
018     */
019    public EJB3EnumerationFacadeLogicImpl(final Object metaObject, final String context)
020    {
021        super (metaObject, context);
022    }
023
024    /**
025     * @see EJB3EnumerationFacadeLogic#handleGetMemberVariablesAsList(java.util.Collection, boolean, boolean)
026     */
027    @Override
028    protected String handleGetMemberVariablesAsList(
029            final Collection variables,
030            final boolean includeTypes,
031            final boolean includeNames)
032    {
033        if (!includeNames && !includeTypes || (variables == null))
034        {
035            return "";
036        }
037
038        StringBuilder sb = new StringBuilder();
039        String separator = "";
040
041        for (Object obj : variables)
042        {
043            final AttributeFacade attr = (AttributeFacade)obj;
044            sb.append(separator);
045            separator = ", ";
046            if (includeTypes)
047            {
048                sb.append(attr.getGetterSetterTypeName());
049                sb.append(" ");
050            }
051            if (includeNames)
052            {
053                sb.append(attr.getName());
054            }
055        }
056        return sb.toString();
057    }
058}