fromTypeNumber static method

OptionType fromTypeNumber(
  1. int type
)

Creates a new OptionType object from a numeric type.

Implementation

static OptionType fromTypeNumber(final int type) {
  final optionType = _registry[type];

  if (optionType != null) {
    return optionType;
  }

  if (type.isOdd) {
    throw UnknownCriticalOptionException(type);
  } else {
    throw UnknownElectiveOptionException(type);
  }
}