22 lines
587 B
Java
22 lines
587 B
Java
package com.github.dtschust.zork.types;
|
|
|
|
import java.util.EnumSet;
|
|
import java.util.Optional;
|
|
|
|
public enum ZorkGameStatusType {
|
|
ROOM("room"),
|
|
ITEM("item"),
|
|
CONTAINER("container"),
|
|
CREATURE("creature");
|
|
|
|
private final String propertyName;
|
|
|
|
ZorkGameStatusType(final String propertyName) {
|
|
this.propertyName = propertyName;
|
|
}
|
|
|
|
public static Optional<ZorkGameStatusType> fromPropertyName(final String propertyName) {
|
|
return EnumSet.allOf(ZorkGameStatusType.class).stream().filter(e -> e.propertyName.equals(propertyName)).findFirst();
|
|
}
|
|
}
|