MethodDD.java :  » J2EE » ow2-easybeans » org » ow2 » easybeans » deployment » xml » struct » common » Java Open Source

Java Open Source » J2EE » ow2 easybeans 
ow2 easybeans » org » ow2 » easybeans » deployment » xml » struct » common » MethodDD.java
/**
 * EasyBeans
 * Copyright (C) 2006 Bull S.A.S.
 * Contact: easybeans@ow2.org
 *
 * This library 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 2.1 of the License, or any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id: MethodDD.java 2054 2007-11-20 14:43:55Z benoitf $
 * --------------------------------------------------------------------------
 */

package org.ow2.easybeans.deployment.xml.struct.common;

import java.util.LinkedList;
import java.util.List;

/**
 * This class defines the <method> element.
 * @author Florent Benoit
 */
public class MethodDD {

    /**
     * Name of the method.
     */
    private String name = null;

    /**
     * List of params.
     */
    private List<String> params = null;

    /**
     * EJB-Name associated to this method.
     */
    private String ejbName = null;

    /**
     * Default constructor.
     */
    public MethodDD() {
        this.params = new LinkedList<String>();
    }

    /**
     * Gets the name of the method.
     * @return the method's name.
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name of the method.
     * @param name the name of the method.
     */
    public void setName(final String name) {
        this.name = name;
    }

    /**
     * Gets the params of this method.
     * @return the method's name.
     */
    public List<String> getParams() {
        return params;
    }

    /**
     * Add a param for this method.
     * @param param the given parameter of the method
     */
    public void addParam(final String param) {
        params.add(param);
    }

    /**
     * @return name of the EJB.
     */
    public String getEjbName() {
        return ejbName;
    }

    /**
     * Sets the name of the EJB.
     * @param ejbName the given name.
     */
    public void setEjbName(final String ejbName) {
        this.ejbName = ejbName;
    }

    /**
     * @return string representation of this module.
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder(MethodDD.class.getSimpleName());
        sb.append("[name=");
        sb.append(name);

        if (ejbName != null) {
            sb.append(", ejbName=");
            sb.append(ejbName);
        }

        if (params.size() > 0) {
            sb.append(", params={");
            for (String param : params) {
                sb.append(param);
                sb.append(",");
            }
            sb.append("}");
        }
        sb.append("]");
        return sb.toString();
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.