Package org.devacfr.maven.skins.reflow
Interface ISkinConfig
-
- All Known Implementing Classes:
SkinConfigTool
public interface ISkinConfigInterface of skin config.- Since:
- 2.1
- Author:
- devacfr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Teval(String vtl, Class<T> requiredClass)Evaluate a velocity expression in the current context.org.codehaus.plexus.util.xml.Xpp3Domget(String property)Default accessor for config properties.<T> Optional<T>getAttributeValue(String property, String attribute, Class<T> targetType)Gets the attribute value of the givenattributeofproperty.<T> TgetAttributeValue(String property, String attribute, Class<T> targetType, T defaultValue)Gets the attribute value of the givenattributeofproperty.<T> Optional<T>getAttributeValue(org.codehaus.plexus.util.xml.Xpp3Dom element, String attribute, Class<T> targetType)Get the value contained in specific attribute ofelementparameter.<T> TgetAttributeValue(org.codehaus.plexus.util.xml.Xpp3Dom element, String attribute, Class<T> targetType, T defaultValue)Get the value contained in specific attribute ofelementparameter.StringgetBodyContent()DategetBuildOutputTimestamp()<T extends Context<Context<?>>>
TgetContext()<T> TgetContextValue(String key, Class<T> type)Gets the associated value tokeystored in Velocity context.StringgetDatePosition()Gets the date position of the site.StringgetFileId()org.codehaus.plexus.util.xml.Xpp3DomgetGlobalProperties()HtmlToolgetHtmlTool()StringgetNamespace()org.codehaus.plexus.util.xml.Xpp3DomgetPageProperties()org.apache.maven.project.MavenProjectgetProject()ObjectgetProjectId()<T> Optional<T>getPropertyValue(String property, Class<T> targetType)Gets the text value of the givenproperty.<T> TgetPropertyValue(String property, Class<T> targetType, T defaultValue)Gets the text value of the givenproperty.StringgetPublishDate()Gets the publish date of the site.StringgetPublishDateMessage()Gets the publish date message of the site.StringgetResourcePath()StringgetShortTitle()Gets the short title of the site.org.apache.maven.doxia.site.SiteModelgetSiteModel()StringgetTitle()Gets the title of the site.<T> TgetToolbox(String toolName, Class<T> toolType)Gets the associated tool tonamestored in toolbox of Velocity context.org.apache.velocity.context.ContextgetVelocityContext()StringgetVersion()Gets the version of the site.StringgetVersionMessage()Gets the version message of the site.StringgetVersionPosition()Gets the position of the version in the site.booleanisActiveLink(String href)Gets the indicating if the link is active.booleanisExternalLink(String url)booleannot(String property)A convenience method to check if the value of thepropertyis"false".StringrelativeLink(String href)StringrenderSnippet(String snippet)StringrenderSnippets(String bodyContent)Renders the snippets found in the body content.voidsetContextValue(String key, Object value)Sets the value in Velocity context associated tokey.
-
-
-
Method Detail
-
renderSnippets
@Nonnull String renderSnippets(String bodyContent) throws Exception
Renders the snippets found in the body content.
-
not
boolean not(String property)
A convenience method to check if the value of thepropertyis"false". Useful for properties that are enabled by default - checks if the property is set to"false"explicitly.- Parameters:
property- the property of interest- Returns:
trueif the configuration value is set either in page or globally, and is equal to"false". Note that this will returnfalseif property is not set at all.- Since:
- 1.0
- See Also:
get(String)
-
getContextValue
<T> T getContextValue(@Nonnull String key, @Nonnull Class<T> type)
Gets the associated value tokeystored in Velocity context.- Type Parameters:
T- the type of expected value.- Parameters:
key- the key name of associated value in Velocity context.type- the the type of expected value.- Returns:
- Returns the associated value to
keystored in Velocity context. - Since:
- 2.1
-
setContextValue
void setContextValue(@Nonnull String key, Object value)
Sets the value in Velocity context associated tokey.- Parameters:
key- the key name of associated value in Velocity context.value- the new value- Since:
- 2.1
-
getVelocityContext
org.apache.velocity.context.Context getVelocityContext()
- Returns:
- the velocity Context
-
getToolbox
@Nullable <T> T getToolbox(@Nonnull String toolName, @Nonnull Class<T> toolType)
Gets the associated tool tonamestored in toolbox of Velocity context.- Type Parameters:
T- the type of expected tool.- Parameters:
toolName- the name of tool associated in Velocity context.toolType- the expected class of tool.- Returns:
- Returns the associated tool to
namestored in toolbox of Velocity context. - Since:
- 2.1
-
getShortTitle
@Nonnull String getShortTitle()
Gets the short title of the site.- Returns:
- Returns the short title of the site.
- Since:
- 2.4
-
getTitle
@Nonnull String getTitle()
Gets the title of the site.- Returns:
- Returns the title of the site.
- Since:
- 2.4
-
getVersion
@Nonnull String getVersion()
Gets the version of the site.- Returns:
- Returns the version of the site.
- Since:
- 2.4
-
getVersionPosition
@Nonnull String getVersionPosition()
Gets the position of the version in the site.- Returns:
- Returns the position of the version in the site.
- Since:
- 2.4
-
getVersionMessage
@Nonnull String getVersionMessage()
Gets the version message of the site.- Returns:
- Returns the version message of the site.
- Since:
- 2.4
-
getPublishDate
@Nullable String getPublishDate()
Gets the publish date of the site.- Returns:
- Returns the publish date of the site.
- Since:
- 2.4
-
getPublishDateMessage
@Nonnull String getPublishDateMessage()
Gets the publish date message of the site.- Returns:
- Returns the publish date message of the site.
- Since:
- 2.4
-
getDatePosition
@Nonnull String getDatePosition()
Gets the date position of the site.- Returns:
- Returns the date position of the site.
- Since:
- 2.4
-
getGlobalProperties
@Nonnull org.codehaus.plexus.util.xml.Xpp3Dom getGlobalProperties()
- Returns:
- Returns the root level
Xpp3Dom.
-
getPageProperties
@Nonnull org.codehaus.plexus.util.xml.Xpp3Dom getPageProperties()
- Returns:
- Returns the page level
Xpp3Dom.
-
getProjectId
@Nullable Object getProjectId()
- Returns:
- Returns the
Stringrepresenting the projectId.
-
getProject
@Nullable org.apache.maven.project.MavenProject getProject()
- Returns:
- the project
-
getSiteModel
@Nullable org.apache.maven.doxia.site.SiteModel getSiteModel()
- Returns:
- the SiteModel
-
get
@Nullable org.codehaus.plexus.util.xml.Xpp3Dom get(@Nonnull String property)
Default accessor for config properties. Instead of using$config.get("myproperty"), one can utilise Velocity fallback onto the default getter and use$config.myproperty.- Parameters:
property- the property of interest- Returns:
- configuration node if found in the following sequence:
- In page configuration
- In global configuration
nullotherwise
- Since:
- 1.0
-
getPropertyValue
@Nullable <T> T getPropertyValue(@Nonnull String property, @Nonnull Class<T> targetType, @Nullable T defaultValue)
Gets the text value of the givenproperty.- Type Parameters:
T- the type of returned object.- Parameters:
property- the property to usetargetType- the returned target type use to convert value.defaultValue- the default value used if property doesn't exist.- Returns:
- Returns a converted value of the given
property. - Since:
- 2.0
-
getPropertyValue
@Nonnull <T> Optional<T> getPropertyValue(@Nonnull String property, @Nonnull Class<T> targetType)
Gets the text value of the givenproperty.- Type Parameters:
T- the type of returned object.- Parameters:
property- the property to usetargetType- the returned target type use to convert value.- Returns:
- Returns a converted value of the given
property. - Since:
- 2.0
-
getAttributeValue
@Nullable <T> T getAttributeValue(@Nonnull String property, @Nonnull String attribute, @Nonnull Class<T> targetType, @Nullable T defaultValue)
Gets the attribute value of the givenattributeofproperty.- Type Parameters:
T- the type of returned object.- Parameters:
property- the property to useattribute- the attribute to use.targetType- the returned target type use to convert value.defaultValue- the default value used if property doesn't exist.- Returns:
- Returns a converted value of the given
property. - Since:
- 2.0
-
getAttributeValue
@Nonnull <T> Optional<T> getAttributeValue(@Nonnull String property, @Nonnull String attribute, @Nonnull Class<T> targetType)
Gets the attribute value of the givenattributeofproperty.- Type Parameters:
T- the type of returned object.- Parameters:
property- the property to useattribute- the attribute to use.targetType- the returned target type use to convert value.- Returns:
- Returns a converted value of the given
property. - Since:
- 2.0
-
getAttributeValue
@Nullable <T> T getAttributeValue(@Nonnull org.codehaus.plexus.util.xml.Xpp3Dom element, @Nonnull String attribute, @Nonnull Class<T> targetType, T defaultValue)
Get the value contained in specific attribute ofelementparameter.- Type Parameters:
T- the type of returned value.- Parameters:
element- the xml element.attribute- the attribute name.targetType- the class of converted returned value.defaultValue- the value to return if attribute is empty ornull.- Returns:
- Returns the converted value of specific attribute of
elementparameter if exists, otherwise returns the default value.
-
getAttributeValue
@Nonnull <T> Optional<T> getAttributeValue(@Nonnull org.codehaus.plexus.util.xml.Xpp3Dom element, @Nonnull String attribute, @Nonnull Class<T> targetType)
Get the value contained in specific attribute ofelementparameter.- Type Parameters:
T- the type of returned value.- Parameters:
element- the xml element.attribute- the attribute name.targetType- the class of converted returned value.- Returns:
- Returns the converted value of specific attribute of
elementparameter if exists, otherwise returns an emptyOptional.
-
relativeLink
@Nullable String relativeLink(String href)
- Parameters:
href- link to relative.- Returns:
- Returns Relativizes the link.
-
isActiveLink
boolean isActiveLink(@Nullable String href)
Gets the indicating if the link is active.- Parameters:
href- the link to check.- Returns:
- Returns
truethe link is active, otherwisefalse.
-
isExternalLink
boolean isExternalLink(String url)
- Parameters:
url- a url.- Returns:
- Returns
truewhether the link is a external link to the site.
-
eval
@Nullable <T> T eval(@Nullable String vtl, @Nonnull Class<T> requiredClass)
Evaluate a velocity expression in the current context.- Type Parameters:
T- Tthe type of expected returned value.- Parameters:
vtl- The velocity expression to evaluaterequiredClass- the class of returned value.- Returns:
- Returns the value returned by the evaluated velocity expression.
-
getResourcePath
@Nonnull String getResourcePath()
- Returns:
- Returns a
Stringrepresenting the relative path to root site.
-
getBuildOutputTimestamp
@Nullable Date getBuildOutputTimestamp() throws ParseException
- Returns:
- Returns the build output timestamp.
- Throws:
ParseException- if the build timestamp can not be parsed.
-
-