public abstract class WebMapper extends Object
Modifier and Type | Field and Description |
---|---|
static WebMapper |
ARXIV
Mapper for an arXiv identifier.
|
static WebMapper |
AUTO
Mapper that tries various strategies to turn a string into a URL.
|
static WebMapper |
BIBCODE
Mapper for a Bibcode.
|
static WebMapper |
BIBCODE_OLD
Mapper for a Bibcode, using the Classic web pages (deprecated by ADS).
|
static WebMapper |
DOI
Mapper for a DOI (Digital Object Identifier).
|
static WebMapper |
FILE
Mapper for pathname of a file in the local filesystem.
|
static WebMapper |
NED
Maps a source identifier to its NED web page.
|
static WebMapper |
NED_CLASSIC
Maps a source identifier to its classic NED web page.
|
static WebMapper |
SIMBAD
Maps a source identifier to its Simbad web page.
|
static WebMapper |
URL
Mapper for a string that's already a URL.
|
Modifier | Constructor and Description |
---|---|
protected |
WebMapper(String name)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static WebMapper |
createMultiMapper(String name,
WebMapper[] others)
Returns a mapper that combines others to come up with a result
if any of them can turn a string into a URL.
|
static WebMapper |
createPrefixMapper(String name,
String urlPrefix)
Returns a mapper that blindly appends the given location string
to a supplied prefix URL, pausing only to URL-encode it.
|
static WebMapper[] |
getMappers()
Returns a list of all the known useful mappers.
|
String |
getName()
Returns the user-visible name for this mapper.
|
String |
toString() |
abstract URL |
toUrl(String txt)
Returns a URL constructed from the given text according to the
knowledge of this WebMapper, if it looks suitable.
|
public static final WebMapper FILE
public static final WebMapper URL
public static final WebMapper BIBCODE
public static final WebMapper DOI
public static final WebMapper ARXIV
public static final WebMapper SIMBAD
public static final WebMapper NED
public static final WebMapper BIBCODE_OLD
public static final WebMapper NED_CLASSIC
public static final WebMapper AUTO
protected WebMapper(String name)
name
- user-visible name for this mapperpublic abstract URL toUrl(String txt)
Where possible, implementations should do enough checking of the format to tell whether the result is likely to be a resolvable URL (though without taking significant time to do it), rather than just making a best effort to come up with a URL that's unlikely to work.
txt
- location stringpublic String getName()
public static WebMapper[] getMappers()
AUTO
mapper will be first in the list.public static WebMapper createPrefixMapper(String name, String urlPrefix)
name
- mapper namepublic static WebMapper createMultiMapper(String name, WebMapper[] others)
name
- mapper nameothers
- list of WebMappers to which this one will
try delegating in turnCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.