package org.jboss.invocation;
import java.io.Serializable;
import java.io.ObjectStreamException;
public final class InvocationType implements Serializable
{
private static final long serialVersionUID = 6460196085190851775L;
private static final String[] INTERFACE_NAMES = { "Remote",
"Local", "Home", "LocalHome", "ServiceEndpoint"
};
private static final int MAX_TYPE_ID = 4;
private static final InvocationType[] values = new InvocationType[MAX_TYPE_ID+1];
public static final InvocationType REMOTE =
new InvocationType("REMOTE", 0);
public static final InvocationType LOCAL =
new InvocationType("LOCAL", 1);
public static final InvocationType HOME =
new InvocationType("HOME", 2);
public static final InvocationType LOCALHOME =
new InvocationType("LOCALHOME", 3);
public static final InvocationType SERVICE_ENDPOINT =
new InvocationType("SERVICE_ENDPOINT", 4);
private final transient String name;
private final int ordinal;
private InvocationType(String name, int ordinal)
{
this.name = name;
this.ordinal = ordinal;
values[ordinal] = this;
}
public String toString()
{
return name;
}
public String toInterfaceString()
{
return INTERFACE_NAMES[ordinal];
}
Object readResolve() throws ObjectStreamException
{
return values[ordinal];
}
}