Interface ConverterContext
-
- All Known Implementing Classes:
JavaClassConverterContext
public interface ConverterContext
Context which is passed toJavadocBlockTagsToXhtmlConverter
,JavadocInlineTagsToXhtmlConverter
,JavadocBlockTagToHtmlConverter
andJavadocBlockTagToHtmlConverter
. It contains metadata about the container class and allows to resolve class or member names which are not fully qualified as well as creating (deep-) links to javadoc pages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canGetUrl()
<T> T
getAttribute(String name, Class<T> clazz, T defaultValue)
Retrieves some attribute value from the current context.URI
getInternalJavadocSiteBaseUrl()
Returns the base url to use for internal javadoc linksString
getLocation()
Optional<String>
getModuleName()
String
getPackageName()
String
getStaticFieldValue(FullyQualifiedJavadocReference reference)
Returns the value of a referenced static field.URI
getUrl(FullyQualifiedJavadocReference reference)
Returns a (deep-)link to the javadoc page for the given referenceboolean
isReferencedBy(FullyQualifiedJavadocReference reference)
FullyQualifiedJavadocReference
resolveReference(JavadocReference reference)
Resolves a given javadoc reference, according to the rules of Javadoc's search order.<T> T
setAttribute(String name, T value)
Stores some attribute in the current context
-
-
-
Method Detail
-
getModuleName
Optional<String> getModuleName()
- Returns:
- the module name of the container class
-
getPackageName
String getPackageName()
- Returns:
- the package name of the container class
-
isReferencedBy
boolean isReferencedBy(FullyQualifiedJavadocReference reference)
- Parameters:
reference
-- Returns:
- true in case either the current container class or any of its super classes are referenced
-
getLocation
String getLocation()
- Returns:
- a location text (human readable) indicating where in the container class the conversion is triggered (should be as specific as possible to ease debugging)
-
resolveReference
FullyQualifiedJavadocReference resolveReference(JavadocReference reference)
Resolves a given javadoc reference, according to the rules of Javadoc's search order.- Parameters:
reference
- the reference to resolve- Returns:
- the resolved fully qualified reference
- Throws:
IllegalArgumentException
- in case the reference cannot be resolved
-
canGetUrl
boolean canGetUrl()
- Returns:
true
if links to javadoc pages could potentially be generated withgetUrl(FullyQualifiedJavadocReference)
.
-
getUrl
URI getUrl(FullyQualifiedJavadocReference reference)
Returns a (deep-)link to the javadoc page for the given reference- Parameters:
reference
- the reference for which to get the url- Returns:
- the link
- Throws:
IllegalArgumentException
- in case no javadoc link could be generated for the given referenceIllegalStateException
- in case no javadoc source sites have been configured (i.e.canGetUrl()
returnsfalse
)
-
getStaticFieldValue
String getStaticFieldValue(FullyQualifiedJavadocReference reference)
Returns the value of a referenced static field.- Parameters:
reference
- the code reference towards a static field- Returns:
- the value of the static field given by the
reference
- Throws:
IllegalArgumentException
- in case the reference does not point to a valid static field
-
getInternalJavadocSiteBaseUrl
URI getInternalJavadocSiteBaseUrl()
Returns the base url to use for internal javadoc links- Returns:
- the base url for internal javadoc links (may be
null
).
-
setAttribute
<T> T setAttribute(String name, T value)
Stores some attribute in the current context- Type Parameters:
T
-- Parameters:
name
-value
-- Returns:
- the old attribute value or null.
-
getAttribute
<T> T getAttribute(String name, Class<T> clazz, T defaultValue)
Retrieves some attribute value from the current context.- Type Parameters:
T
-- Parameters:
name
-clazz
-defaultValue
-- Returns:
- the value of the attribute with the given name or
null
if it does not exist
-
-