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 URIstatic final intThe 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-listorelement-list.JavadocSite(URI url, JavadocLinkGenerator.JavadocToolVersionRange version, boolean requireModuleNameInPath) Constructor for offline sites. -
Method Summary
Modifier and TypeMethodDescription(package private) URIappendMemberAsFragment(URI url, Optional<String> optionalMember, Optional<FullyQualifiedJavadocReference.MemberType> optionalMemberType) (package private) URIappendMemberAsFragment(URI url, FullyQualifiedJavadocReference reference) private static org.apache.http.impl.client.CloseableHttpClientcreateHttpClient(org.apache.maven.settings.Settings settings, URL url) Creates a newHttpClientinstance.createLink(String packageName, String className) Generates a link to a javadoc html page below the javadoc site represented by this object.(package private) static URIcreateLink(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 URIcreateLink(FullyQualifiedJavadocReference javadocReference, URI baseUri, BiFunction<URI, FullyQualifiedJavadocReference, URI> fragmentAppender) (package private) static URIcreateLink(FullyQualifiedJavadocReference javadocReference, URI baseUri, BiFunction<URI, FullyQualifiedJavadocReference, URI> fragmentAppender, Optional<String> pathPrefix) (package private) booleanfindAnchor(URI uri, String anchorNameOrId) (package private) static booleanfindLineContaining(URI url, org.apache.maven.settings.Settings settings, Pattern pattern) (package private) static PatterngetAnchorPattern(String anchorNameOrId) (package private) static StringgetFragmentForMember(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 BufferedReaderbooleanhasEntryFor(Optional<String> moduleName, Optional<String> packageName) static booleanisNotEmpty(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-listorelement-list.- Parameters:
url-settings-- Throws:
IOException
-
JavadocSite
JavadocSite(URI url, JavadocLinkGenerator.JavadocToolVersionRange version, boolean requireModuleNameInPath) Constructor for offline sites. This throwsUnsupportedOperationExceptionforhasEntryFor(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:
URISyntaxExceptionIOException- 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:
MalformedURLExceptionIOException
-
getAnchorPattern
-
createHttpClient
private static org.apache.http.impl.client.CloseableHttpClient createHttpClient(org.apache.maven.settings.Settings settings, URL url) Creates a newHttpClientinstance.- Parameters:
settings- The settings to use for setting up the client ornull.url- TheURLto use for setting up the client ornull.- Returns:
- A new
HttpClientinstance. - 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:
trueif notnulland not empty, otherwisefalse
-