Created
August 14, 2012 16:31
-
-
Save stoicflame/3350647 to your computer and use it in GitHub Desktop.
new resource types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright 2011-2012 Intellectual Reserve, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
package org.gedcomx.types; | |
import org.codehaus.enunciate.qname.XmlQNameEnum; | |
import org.codehaus.enunciate.qname.XmlQNameEnumValue; | |
import org.codehaus.enunciate.qname.XmlUnknownQNameEnumValue; | |
import org.gedcomx.common.URI; | |
import org.gedcomx.rt.CommonModels; | |
/** | |
* An enumeration of known resource types. Many are defined by the | |
* <a href="http://dublincore.org/documents/dcmi-type-vocabulary/">Dublin Core Type Vocabulary</a>. Others are new resource types | |
* introduced by GEDCOM X. | |
* | |
* @author Ryan Heaton | |
*/ | |
@XmlQNameEnum ( | |
base = XmlQNameEnum.BaseType.URI | |
) | |
public enum ResourceType { | |
/** | |
* A name of a person. Instances of the type person must also be describable as instances of | |
* the broader type Dataset. | |
*/ | |
@XmlQNameEnumValue ( | |
namespace = CommonModels.GEDCOMX_COMMON_NAMESPACE | |
) | |
Name, | |
/** | |
* A fact about a person or relationship. Instances of the type person must also be describable as instances of | |
* the broader type Dataset. | |
*/ | |
@XmlQNameEnumValue ( | |
namespace = CommonModels.GEDCOMX_COMMON_NAMESPACE | |
) | |
Fact, | |
/** | |
* Something else. | |
*/ | |
@XmlUnknownQNameEnumValue | |
OTHER; | |
/** | |
* Return the QName value for this enum. | |
* | |
* @return The QName value for this enum. | |
*/ | |
public URI toQNameURI() { | |
return URI.create(org.codehaus.enunciate.XmlQNameEnumUtil.toURIValue(this)); | |
} | |
/** | |
* Get the enumeration from the QName. | |
* | |
* @param qname The qname. | |
* @return The enumeration. | |
*/ | |
public static ResourceType fromQNameURI(URI qname) { | |
return org.codehaus.enunciate.XmlQNameEnumUtil.fromURIValue(qname.toString(), ResourceType.class); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment