1 16 package org.apache.commons.lang.enum; 17 18 import java.util.Iterator; 19 import java.util.List; 20 import java.util.Map; 21 22 28 public abstract class Broken3OperationEnum extends Enum { 29 public static final Broken3OperationEnum PLUS = new PlusOperation(); 42 private static class PlusOperation extends Broken3OperationEnum { 43 private PlusOperation() { 44 super("Plus"); 45 } 46 public int eval(int a, int b) { 47 return (a + b); 48 } 49 } 50 public static final Broken3OperationEnum MINUS = new MinusOperation(); 51 private static class MinusOperation extends Broken3OperationEnum { 52 private MinusOperation() { 53 super("Minus"); 54 } 55 public int eval(int a, int b) { 56 return (a - b); 57 } 58 } 59 60 private Broken3OperationEnum(String name) { 61 super(name); 62 } 63 64 public final Class getEnumClass() { 65 return Enum.class; 66 } 67 68 public abstract int eval(int a, int b); 69 70 public static Broken3OperationEnum getEnum(String name) { 71 return (Broken3OperationEnum) getEnum(Broken3OperationEnum.class, name); 72 } 73 74 public static Map getEnumMap() { 75 return getEnumMap(Broken3OperationEnum.class); 76 } 77 78 public static List getEnumList() { 79 return getEnumList(Broken3OperationEnum.class); 80 } 81 82 public static Iterator iterator() { 83 return iterator(Broken3OperationEnum.class); 84 } 85 } 86 | Popular Tags |