public static class EnumeratedValues.BasicValue extends Object implements EnumeratedValues.Value
BasicValue is an obvious implementation of EnumeratedValues.Value.| Modifier and Type | Field and Description |
|---|---|
String |
description |
String |
name |
int |
ordinal |
| Constructor and Description |
|---|
BasicValue(String name,
int ordinal,
String description) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(String s)
Deprecated.
I bet you meant to write
value.name_.equals(s) rather than
value.equals(s), didn't you? |
String |
getDescription() |
String |
getName() |
int |
getOrdinal() |
String |
toString()
Returns the value's name.
|
RuntimeException |
unexpected()
Returns an error indicating that we did not expect to find this
value in this context.
|
public final String name
public final int ordinal
public final String description
public String getName()
getName in interface EnumeratedValues.Valuepublic int getOrdinal()
getOrdinal in interface EnumeratedValues.Valuepublic String getDescription()
getDescription in interface EnumeratedValues.Valuepublic boolean equals(String s)
value.name_.equals(s) rather than
value.equals(s), didn't you?public RuntimeException unexpected()
switch
statement:
switch (fruit) {
case Fruit.AppleORDINAL:
return 1;
case Fruir.OrangeORDINAL:
return 2;
default:
throw fruit.unexpected();
}Copyright © 2021 Hitachi Vantara. All rights reserved.