Package org.gbif.api.model.common
Class DOI
- java.lang.Object
-
- org.gbif.api.model.common.DOI
-
- All Implemented Interfaces:
Serializable
public class DOI extends Object implements Serializable
Class representing a single Digital Object Identifier (DOI) breaking it down to a prefix and suffix. For the syntax of DOI names see the DOI Handbook. All parsing is case-insensitive and resulting components will all be uppercased.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DOI.DoiDeserializer
static class
DOI.DoiSerializer
-
Field Summary
Fields Modifier and Type Field Description static String
GBIF_PREFIX
The DOI prefix registered with DataCite to be used by GBIF-issued production DOIs.static String
TEST_PREFIX
A DOI prefix provided by DataCite to be used in tests.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getDoiName()
String
getDoiString()
String
getPrefix()
String
getSuffix()
URI
getUrl()
int
hashCode()
static boolean
isParsable(String source)
Returns true only if the source can be parsed into a DOI.void
setPrefix(String prefix)
void
setSuffix(String suffix)
String
toString()
-
-
-
Field Detail
-
GBIF_PREFIX
public static final String GBIF_PREFIX
The DOI prefix registered with DataCite to be used by GBIF-issued production DOIs.- See Also:
- Constant Field Values
-
TEST_PREFIX
public static final String TEST_PREFIX
A DOI prefix provided by DataCite to be used in tests.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DOI
public DOI()
Do not use this constructor. Required by JAXB to marshall this object without introducing adapters.
-
DOI
public DOI(String doi)
Parses a simple DOI string of various forms incl URN, URL or plain DOI names.- Parameters:
doi
- the full simple DOI string- Throws:
IllegalArgumentException
- if invalid DOI string is passed
-
DOI
public DOI(String prefix, String suffix)
Parses a simple DOI string of various forms incl URN, URL or plain DOI names.- Parameters:
prefix
- a simple DOI prefix starting with 10.suffix
- arbitrary suffix part of the DOI- Throws:
IllegalArgumentException
- if invalid DOI prefix is given
-
-
Method Detail
-
isParsable
public static boolean isParsable(String source)
Returns true only if the source can be parsed into a DOI.
-
getUrl
public URI getUrl()
- Returns:
- the resolved DOI using https://doi.org/
- Throws:
IllegalStateException
- if the encoding of the DOI is not supported
-
getDoiString
public String getDoiString()
- Returns:
- the DOI name prefixed with "doi:", as recommended by the DOI Handbook.
-
getDoiName
public String getDoiName()
- Returns:
- the pure DOI name without any initial scheme name starting with the prefix, i.e. 10.
-
-