/*
 * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

/*
 * $Id: FooIntEnumType.java 62536 2011-04-15 16:35:14Z af70133 $
 */

// This class was generated by the JAXRPC RI, do not edit.
// Contents subject to change without notice.
// JAX-RPC Reference Implementation (1.1, build EA-R15)

package com.sun.ts.tests.jaxrpc.ee.wsi.document.literal.marshalltest;


public class FooIntEnumType implements java.io.Serializable {
    private int value;
    public static final int _value1 = (int)1;
    public static final int _value2 = (int)2;
    public static final int _value3 = (int)3;
    
    public static final FooIntEnumType value1 = new FooIntEnumType(_value1);
    public static final FooIntEnumType value2 = new FooIntEnumType(_value2);
    public static final FooIntEnumType value3 = new FooIntEnumType(_value3);
    
    protected FooIntEnumType(int value) {
        this.value = value;
    }
    
    public int getValue() {
        return value;
    }
    
    public static FooIntEnumType fromValue(int value)
        throws java.lang.IllegalStateException {
        if (value1.value == value) {
            return value1;
        } else if (value2.value == value) {
            return value2;
        } else if (value3.value == value) {
            return value3;
        }
        throw new IllegalArgumentException();
    }
    
    public static FooIntEnumType fromString(String value)
        throws java.lang.IllegalStateException {
        if (value.equals("1")) {
            return value1;
        } else if (value.equals("2")) {
            return value2;
        } else if (value.equals("3")) {
            return value3;
        }
        throw new IllegalArgumentException();
    }
    
    public String toString() {
        return new Integer(value).toString();
    }
    
    public boolean equals(Object obj) {
        if (!(obj instanceof FooIntEnumType)) {
            return false;
        }
        return ((FooIntEnumType)obj).value == value;
    }
    
    public int hashCode() {
        return new Integer(value).toString().hashCode();
    }
}
