fr.dyade.aaa.util

Interface EnumerationType

All Superinterfaces:
java.io.Serializable

public interface EnumerationType
extends java.io.Serializable

Enumerations should implement this interface. A code example is given below.
package fr.dyade.aaa.nw.ar.tests;

import fr.dyade.aaa.util.EnumerationType;

public class CnxState implements EnumerationType {

public static CnxState valueOf(String name) throws Exception {
for (int i = 0; i <32names.length; i++) {
if (name.equals(names[i]))
return values[i];
}
throw new Exception("Format exception: " + name +
" is not a CnxState.");
}

public final static String[] names = {
"no value",
"opened",
"established",
"reset",
"closed",
"free",
"timeout",
"unchanged"
};


public final static int _CNX_NOVALUE = 0;

public final static int _CNX_OPENED = 1;

public final static int _CNX_ESTABLISHED = 2;

public final static int _CNX_RESET = 3;

public final static int _CNX_CLOSED = 4;

public final static int _CNX_FREE = 5;

public final static int _CNX_TIMEOUT = 6;

public final static int _CNX_UNCHANGED = 7;


public final static CnxState CNX_NOVALUE = new CnxState(_CNX_NOVALUE);

public final static CnxState CNX_OPENED = new CnxState(_CNX_OPENED);

public final static CnxState CNX_ESTABLISHED = new CnxState(_CNX_ESTABLISHED);

public final static CnxState CNX_RESET = new CnxState(_CNX_RESET);

public final static CnxState CNX_CLOSED = new CnxState(_CNX_CLOSED);

public final static CnxState CNX_FREE = new CnxState(_CNX_FREE);

public final static CnxState CNX_TIMEOUT = new CnxState(_CNX_TIMEOUT);

public final static CnxState CNX_UNCHANGED = new CnxState(_CNX_UNCHANGED);

public final static CnxState[] values = {CNX_NOVALUE,
CNX_OPENED,
CNX_ESTABLISHED,
CNX_RESET,
CNX_CLOSED,
CNX_FREE,
CNX_TIMEOUT,
CNX_UNCHANGED};

private int index;

private CnxState(int index) {
this.index = index;
}

public int intValue() {
return index;
}

public String toString() {
return names[index];
}


}

Method Summary

int
intValue()

Method Details

intValue

public int intValue()


Copyright B) 2004 Scalagent - All rights reserved