Class HeaderSource
- java.lang.Object
-
- com.mycila.maven.plugin.license.header.HeaderSource
-
- Direct Known Subclasses:
HeaderSource.LiteralHeaderSource,HeaderSource.MultiLiteralHeaderSource,HeaderSource.MultiUrlHeaderSource,HeaderSource.UrlHeaderSource
public abstract class HeaderSource extends Object
Provides an access to the license template text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHeaderSource.LiteralHeaderSourceAHeaderSourcebuilt from a license header template literal.static classHeaderSource.MultiLiteralHeaderSourceAHeaderSourcebuilt from multiple license header template literals.static classHeaderSource.MultiUrlHeaderSourceAHeaderSourceloaded from multipleURL.static classHeaderSource.UrlHeaderSourceAHeaderSourceloaded from aURL.
-
Constructor Summary
Constructors Modifier Constructor Description protectedHeaderSource(String content, boolean inline)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetContent()abstract booleanisFromUrl(URL location)Retunstrueif thisHeaderSourcewas loaded from the URL given in thelocationparameter orfalseotherwise.booleanisInline()static HeaderSourceof(Multi multi, String inlineHeader, String headerPath, String encoding, ResourceFinder finder)Checking the params left to right, returns the first availableHeaderSourcethat can be created.static HeaderSourceof(String headerPath, String encoding, ResourceFinder finder)
-
-
-
Field Detail
-
content
protected final String content
-
-
Constructor Detail
-
HeaderSource
protected HeaderSource(String content, boolean inline)
-
-
Method Detail
-
of
public static HeaderSource of(String headerPath, String encoding, ResourceFinder finder)
-
of
public static HeaderSource of(Multi multi, String inlineHeader, String headerPath, String encoding, ResourceFinder finder)
Checking the params left to right, returns the first availableHeaderSourcethat can be created. IfinlineHeaderis notnullreturns a newHeaderSource.LiteralHeaderSource. Otherwise attempts to create a newHeaderSource.UrlHeaderSourceout ofheaderPathandencoding.- Parameters:
multi- container for multi license, or null if single licenseinlineHeader- the text of a license header templateheaderPath- a path resolvable by thefinderencoding- the encoding to use when readingheaderPathfinder- theResourceFinderto use to resolveheaderPath- Returns:
- a new
HeaderSource
-
getContent
public String getContent()
- Returns:
- the text of the license template
-
isInline
public boolean isInline()
- Returns:
trueif thisHeaderSourcewas created from a string rather by loading the bits from an URL;falseotherwise
-
isFromUrl
public abstract boolean isFromUrl(URL location)
Retunstrueif thisHeaderSourcewas loaded from the URL given in thelocationparameter orfalseotherwise.- Parameters:
location- the URL to tell if thisHeaderSourcewas loaded from it- Returns:
trueif thisHeaderSourcewas loaded from the URL given in thelocationparameter orfalseotherwise
-
-