ar.com.zauber.garfio.modules.mock.model.actions.MockNumberUpdateCustomFieldAction.java Source code

Java tutorial

Introduction

Here is the source code for ar.com.zauber.garfio.modules.mock.model.actions.MockNumberUpdateCustomFieldAction.java

Source

/**
 * Copyright (c) 2007-2009 Zauber S.A. <http://www.zauber.com.ar/>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ar.com.zauber.garfio.modules.mock.model.actions;

import org.apache.commons.lang.Validate;

import ar.com.zauber.garfio.modules.model.Issue;

/**
 * Mock implementation for {@linkplain AbstractMockAction}
 * 
 * 
 * @author Juan F. Codagnone
 * @since Oct 7, 2007
 */
public class MockNumberUpdateCustomFieldAction extends AbstractMockAction {
    private final Issue issue;
    private final String value;

    /**
     * Creates the MockNumberUpdateCustomField.
     *
     * @param issue
     * @param field
     * @param value
     */
    public MockNumberUpdateCustomFieldAction(final Issue issue, final String value) {
        Validate.notNull(issue);
        Validate.notEmpty(value);

        this.issue = issue;
        this.value = value;

    }

    public final Issue getIssue() {
        return issue;
    }

    public final String getValue() {
        return value;
    }

    /** @see Object#equals(Object) */
    @Override
    public final boolean equals(final Object obj) {
        boolean ret = false;

        if (obj == this) {
            ret = true;
        } else if (obj instanceof MockNumberUpdateCustomFieldAction) {
            final MockNumberUpdateCustomFieldAction a = (MockNumberUpdateCustomFieldAction) obj;
            ret = issue.equals(a.issue) && value.equals(a.value);
        }
        return ret;
    }

    /** @see Object#hashCode() */
    @Override
    public final int hashCode() {
        return 17 + 19 * issue.hashCode() + 19 * value.hashCode();
    }

}