
org.enhydra.xml.xmlc.metadata.DocumentFormat Maven / Gradle / Ivy
The newest version!
/*
* Enhydra Java Application Server Project
*
* The contents of this file are subject to the Enhydra Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License on
* the Enhydra web site ( http://www.enhydra.org/ ).
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific terms governing rights and limitations
* under the License.
*
* The Initial Developer of the Enhydra Application Server is Lutris
* Technologies, Inc. The Enhydra Application Server and portions created
* by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
* All Rights Reserved.
*
* Contributor(s):
*
* $Id: DocumentFormat.java,v 1.1.1.1 2003/03/10 16:36:23 taweili Exp $
*/
package org.enhydra.xml.xmlc.metadata;
/**
* Enumerated type for the format of a document (HTML or XML).
*/
public class DocumentFormat extends EnumeratedType {
/**
* Constant for a XML document.
*/
public static final DocumentFormat XML = new DocumentFormat("xml");
/**
* Constant for a HTML document.
*/
public static final DocumentFormat HTML = new DocumentFormat("html");
/**
* Constant for an unspecified document type.
*/
public static final DocumentFormat UNSPECIFIED = new DocumentFormat("unspecified");
/**
* Internal constructor. Only a fixed set of types are allowed.
*/
private DocumentFormat(String name) {
super(name);
}
/**
* Get the object for the specified type. If desiredType is null,
* return UNSPECIFIED.
*/
public static DocumentFormat getType(String desiredType) {
if (desiredType == null) {
return UNSPECIFIED;
} else if (XML.fName.equals(desiredType)) {
return XML;
} else if (HTML.fName.equals(desiredType)) {
return HTML;
} else if (UNSPECIFIED.fName.equals(desiredType)) {
return UNSPECIFIED;
} else {
throw new IllegalArgumentException("Invalid DocumentFormat: \""
+ desiredType
+ "\", expected of \""
+ XML.fName + "\", \""
+ HTML.fName + "\", or \""
+ UNSPECIFIED.fName + "\"");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy