Class JavadocSite
java.lang.Object
org.apache.maven.tools.plugin.javadoc.JavadocSite
Allows to create links to a site generated by javadoc (incl. deep-linking).
The site may be either accessible (online) or non-accessible (offline) when using this class.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final URI
static final int
The default timeout used when fetching url, i.e.private static final String
(package private) final boolean
(package private) final org.apache.maven.settings.Settings
(package private) JavadocLinkGenerator.JavadocToolVersionRange
(package private) static final EnumMap<FullyQualifiedJavadocReference.MemberType,
EnumSet<JavadocLinkGenerator.JavadocToolVersionRange>> -
Constructor Summary
ConstructorsConstructorDescriptionJavadocSite
(URI url, org.apache.maven.settings.Settings settings) Constructor for online sites having an accessiblepackage-list
orelement-list
.JavadocSite
(URI url, JavadocLinkGenerator.JavadocToolVersionRange version, boolean requireModuleNameInPath) Constructor for offline sites. -
Method Summary
Modifier and TypeMethodDescription(package private) URI
appendMemberAsFragment
(URI url, Optional<String> optionalMember, Optional<FullyQualifiedJavadocReference.MemberType> optionalMemberType) (package private) URI
appendMemberAsFragment
(URI url, FullyQualifiedJavadocReference reference) private static org.apache.http.impl.client.CloseableHttpClient
createHttpClient
(org.apache.maven.settings.Settings settings, URL url) Creates a newHttpClient
instance.createLink
(String packageName, String className) Generates a link to a javadoc html page below the javadoc site represented by this object.(package private) static URI
createLink
(URI baseUri, Optional<String> moduleName, Optional<String> packageName, Optional<String> className) createLink
(FullyQualifiedJavadocReference javadocReference) Generates a link to a javadoc html page below the javadoc site represented by this object.(package private) static URI
createLink
(FullyQualifiedJavadocReference javadocReference, URI baseUri, BiFunction<URI, FullyQualifiedJavadocReference, URI> fragmentAppender) (package private) static URI
createLink
(FullyQualifiedJavadocReference javadocReference, URI baseUri, BiFunction<URI, FullyQualifiedJavadocReference, URI> fragmentAppender, Optional<String> pathPrefix) (package private) boolean
findAnchor
(URI uri, String anchorNameOrId) (package private) static boolean
findLineContaining
(URI url, org.apache.maven.settings.Settings settings, Pattern pattern) (package private) static Pattern
getAnchorPattern
(String anchorNameOrId) (package private) static String
getFragmentForMember
(JavadocLinkGenerator.JavadocToolVersionRange version, String member, boolean isConstructor) canonical format given by member is using parentheses and comma.getPackageAndClassName
(String binaryName) Splits up a given binary class name into package name and simple class name part.getPackageListWithModules
(URI url, org.apache.maven.settings.Settings settings) (package private) static BufferedReader
boolean
hasEntryFor
(Optional<String> moduleName, Optional<String> packageName) static boolean
isNotEmpty
(Collection<?> collection) Convenience method to determine that a collection is not empty or null.
-
Field Details
-
PREFIX_MODULE
- See Also:
-
baseUri
-
settings
final org.apache.maven.settings.Settings settings -
containedPackageNamesAndModules
-
requireModuleNameInPath
final boolean requireModuleNameInPath -
VERSIONS_PER_TYPE
static final EnumMap<FullyQualifiedJavadocReference.MemberType,EnumSet<JavadocLinkGenerator.JavadocToolVersionRange>> VERSIONS_PER_TYPE -
version
-
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUTThe default timeout used when fetching url, i.e. 2000.- See Also:
-
-
Constructor Details
-
JavadocSite
JavadocSite(URI url, org.apache.maven.settings.Settings settings) throws IOException Constructor for online sites having an accessiblepackage-list
orelement-list
.- Parameters:
url
-settings
-- Throws:
IOException
-
JavadocSite
JavadocSite(URI url, JavadocLinkGenerator.JavadocToolVersionRange version, boolean requireModuleNameInPath) Constructor for offline sites. This throwsUnsupportedOperationException
forhasEntryFor(Optional, Optional)
.
-
-
Method Details
-
getPackageListWithModules
static Map<String,String> getPackageListWithModules(URI url, org.apache.maven.settings.Settings settings) throws IOException - Throws:
IOException
-
findLineContaining
static boolean findLineContaining(URI url, org.apache.maven.settings.Settings settings, Pattern pattern) throws IOException - Throws:
IOException
-
getBaseUri
-
hasEntryFor
-
createLink
Generates a link to a javadoc html page below the javadoc site represented by this object. The link is not validated (i.e. might point to a non-existing page)- Returns:
- the (deep-)link towards a javadoc page
- Throws:
IllegalArgumentException
- if no link can be created
-
getPackageAndClassName
Splits up a given binary class name into package name and simple class name part.- Parameters:
binaryName
- a binary name according to JLS 13.1- Returns:
- a key value pair where the key is the package name and the value the class name
- Throws:
IllegalArgumentException
- if no link can be created
-
createLink
public URI createLink(FullyQualifiedJavadocReference javadocReference) throws IllegalArgumentException Generates a link to a javadoc html page below the javadoc site represented by this object. The link is not validated (i.e. might point to a non-existing page)- Parameters:
javadocReference
- a code reference from a javadoc tag- Returns:
- the (deep-)link towards a javadoc page
- Throws:
IllegalArgumentException
- if no link can be created
-
createLink
static URI createLink(FullyQualifiedJavadocReference javadocReference, URI baseUri, BiFunction<URI, FullyQualifiedJavadocReference, URI> fragmentAppender) -
createLink
static URI createLink(FullyQualifiedJavadocReference javadocReference, URI baseUri, BiFunction<URI, FullyQualifiedJavadocReference, throws IllegalArgumentExceptionURI> fragmentAppender, Optional<String> pathPrefix) - Throws:
IllegalArgumentException
-
createLink
static URI createLink(URI baseUri, Optional<String> moduleName, Optional<String> packageName, Optional<String> className) throws URISyntaxException - Throws:
URISyntaxException
-
appendMemberAsFragment
-
appendMemberAsFragment
URI appendMemberAsFragment(URI url, Optional<String> optionalMember, Optional<FullyQualifiedJavadocReference.MemberType> optionalMemberType) throws URISyntaxException, IOException - Parameters:
url
-optionalMember
-optionalMemberType
-- Returns:
- Throws:
URISyntaxException
IOException
- See Also:
-
getFragmentForMember
static String getFragmentForMember(JavadocLinkGenerator.JavadocToolVersionRange version, String member, boolean isConstructor) canonical format given by member is using parentheses and comma.- Parameters:
version
-member
-isConstructor
-- Returns:
- the anchor
-
findAnchor
- Throws:
MalformedURLException
IOException
-
getAnchorPattern
-
createHttpClient
private static org.apache.http.impl.client.CloseableHttpClient createHttpClient(org.apache.maven.settings.Settings settings, URL url) Creates a newHttpClient
instance.- Parameters:
settings
- The settings to use for setting up the client ornull
.url
- TheURL
to use for setting up the client ornull
.- Returns:
- A new
HttpClient
instance. - Since:
- 2.8
- See Also:
-
getReader
static BufferedReader getReader(URL url, org.apache.maven.settings.Settings settings) throws IOException - Throws:
IOException
-
isNotEmpty
Convenience method to determine that a collection is not empty or null.- Parameters:
collection
- the collection to verify- Returns:
true
if notnull
and not empty, otherwisefalse
-