1 23 24 package org.enhydra.xml.xmlc.metadata; 25 26 30 public class GenerateType extends EnumeratedType { 31 34 public static final GenerateType CLASS = new GenerateType("class"); 35 36 39 public static final GenerateType INTERFACE = new GenerateType("interface"); 40 41 44 public static final GenerateType IMPLEMENTATION = new GenerateType("implementation"); 45 46 49 public static final GenerateType BOTH = new GenerateType("both"); 50 51 54 private GenerateType(String name) { 55 super(name); 56 } 57 58 61 public boolean generateClass() { 62 return (this == CLASS) || (this == IMPLEMENTATION) || (this == BOTH); 63 } 64 65 68 public boolean generateInterface() { 69 return (this == INTERFACE) || (this == BOTH); 70 } 71 72 76 public static GenerateType getType(String desiredType) { 77 if (desiredType == null) { 78 return null; 79 } else if (CLASS.fName.equals(desiredType)) { 80 return CLASS; 81 } else if (INTERFACE.fName.equals(desiredType)) { 82 return INTERFACE; 83 } else if (IMPLEMENTATION.fName.equals(desiredType)) { 84 return IMPLEMENTATION; 85 } else if (BOTH.fName.equals(desiredType)) { 86 return BOTH; 87 } else { 88 throw new IllegalArgumentException ("Invalid GenerateType: \"" 89 + desiredType 90 + "\", expected one of \"" 91 + CLASS 92 + "\", \", " 93 + INTERFACE 94 + "\", \"" 95 + IMPLEMENTATION 96 + "\", \"" 97 + BOTH 98 + "\""); 99 } 100 } 101 } 102 | Popular Tags |