1 23 24 package org.enhydra.xml.xmlc.metadata; 25 26 29 public class DocumentFormat extends EnumeratedType { 30 33 public static final DocumentFormat XML = new DocumentFormat("xml"); 34 35 38 public static final DocumentFormat HTML = new DocumentFormat("html"); 39 40 43 public static final DocumentFormat UNSPECIFIED = new DocumentFormat("unspecified"); 44 45 48 private DocumentFormat(String name) { 49 super(name); 50 } 51 52 56 public static DocumentFormat getType(String desiredType) { 57 if (desiredType == null) { 58 return UNSPECIFIED; 59 } else if (XML.fName.equals(desiredType)) { 60 return XML; 61 } else if (HTML.fName.equals(desiredType)) { 62 return HTML; 63 } else if (UNSPECIFIED.fName.equals(desiredType)) { 64 return UNSPECIFIED; 65 } else { 66 throw new IllegalArgumentException ("Invalid DocumentFormat: \"" 67 + desiredType 68 + "\", expected of \"" 69 + XML.fName + "\", \"" 70 + HTML.fName + "\", or \"" 71 + UNSPECIFIED.fName + "\""); 72 } 73 } 74 } 75 | Popular Tags |