Package org.gbif.api.util
Class VocabularyUtils
java.lang.Object
org.gbif.api.util.VocabularyUtils
-
Method Summary
Modifier and TypeMethodDescriptionSame aslookupEnum(String, Class)} without IllegalArgumentException.static <T extends Enum<?>>
TlookupEnum(String name, Class<T> vocab) Generic method to lookup an enumeration value for a given string based on the name of the enum member.lookupVocabulary(String fullyQualifiedClassName) Looks up an enumeration by class name.static ContactTypeparseContactType(String type) static EndpointTypeparseEndpointType(String type) static IdentifierTypeparseIdentifierType(String type) static TechnicalInstallationTypeDeprecated.
-
Method Details
-
parseContactType
-
parseEndpointType
-
parseIdentifierType
-
parseTechnicalInstallationType
Deprecated. -
lookupEnum
Generic method to lookup an enumeration value for a given string based on the name of the enum member. The lookup is case insensitive and ignore whitespaces, underscores and dashes.- Parameters:
name- the enum members name to lookupvocab- the enumeration class- Returns:
- the matching enum member or null if
nameis null or empty (see http://dev.gbif.org/issues/browse/POR-2858) - Throws:
IllegalArgumentException- if the name cannot be parsed into a known name
-
lookup
Same aslookupEnum(String, Class)} without IllegalArgumentException. On failure, this method will return Optional.empty().- Returns:
- instance of Optional, never null.
-
lookupVocabulary
Looks up an enumeration by class name. One can get the classname using the likes of:Country.class.getName()- Parameters:
fullyQualifiedClassName- Which should name the enumeration (e.g. org.gbif.api.vocabulary.Country)- Returns:
- The enumeration or null if
fullyQualifiedClassNameis null or empty (see http://dev.gbif.org/issues/browse/POR-2858) - Throws:
IllegalArgumentException- iffullyQualifiedClassNameclass cannot be located
-