package org.jboss.axis.attachments;
import org.jboss.axis.utils.Messages;
public final class DimeTypeNameFormat
{
private byte format = 0;
private DimeTypeNameFormat()
{
}
private DimeTypeNameFormat(byte f)
{
format = f;
}
static final byte NOCHANGE_VALUE = 0x00; static final byte MIME_VALUE = 0x01; static final byte URI_VALUE = 0x02; static final byte UNKNOWN_VALUE = 0x03; static final byte NODATA_VALUE = 0x04;
static final DimeTypeNameFormat NOCHANGE =
new DimeTypeNameFormat(NOCHANGE_VALUE);
public static final DimeTypeNameFormat MIME =
new DimeTypeNameFormat(MIME_VALUE);
public static final DimeTypeNameFormat URI =
new DimeTypeNameFormat(URI_VALUE);
public static final DimeTypeNameFormat UNKNOWN =
new DimeTypeNameFormat(UNKNOWN_VALUE);
static final DimeTypeNameFormat NODATA =
new DimeTypeNameFormat(NODATA_VALUE);
private static String[] toEnglish = {"NOCHANGE", "MIME", "URI",
"UNKNOWN", "NODATA"};
private static DimeTypeNameFormat[] fromByte = {NOCHANGE, MIME,
URI, UNKNOWN, NODATA};
public final String toString()
{
return toEnglish[format];
}
public final byte toByte()
{
return format;
}
public final boolean equals(final Object x)
{
if (x == null)
{
return false;
}
if (!(x instanceof DimeTypeNameFormat))
{
return false;
}
return ((DimeTypeNameFormat)x).format == this.format;
}
public static DimeTypeNameFormat parseByte(byte x)
{
if (x < 0 || x > fromByte.length)
{
throw new IllegalArgumentException(Messages.getMessage("attach.DimeStreamBadType", "" + x));
}
return fromByte[x];
}
public static DimeTypeNameFormat parseByte(Byte x)
{
return parseByte(x.byteValue());
}
}