Class Header
- java.lang.Object
-
- com.google.code.mojo.license.header.Header
-
public final class Header extends java.lang.ObjectTheHeaderclass wraps the license template file, the one which have to be outputted inside the other files.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Map<java.lang.String,java.lang.String>EMPTY_PROPERTIESprivate java.lang.StringheaderContentprivate java.lang.StringheaderContentOneLineprivate java.lang.String[]linesprivate java.net.URLlocation
-
Constructor Summary
Constructors Constructor Description Header(java.net.URL location, java.util.Map<java.lang.String,java.lang.String> properties)Constructs aHeaderobject pointing to a license template file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringasOneLineString()java.lang.StringasString()java.lang.StringbuildForDefinition(HeaderDefinition type, boolean unix)java.lang.Stringeol(boolean unix)intgetLineCount()java.lang.String[]getLines()java.net.URLgetLocation()Returns the location of license template file.private booleannotEmpty(java.lang.String str)java.lang.StringtoString()
-
-
-
Field Detail
-
location
private final java.net.URL location
-
headerContent
private final java.lang.String headerContent
-
headerContentOneLine
private final java.lang.String headerContentOneLine
-
lines
private java.lang.String[] lines
-
EMPTY_PROPERTIES
private static final java.util.Map<java.lang.String,java.lang.String> EMPTY_PROPERTIES
-
-
Constructor Detail
-
Header
public Header(java.net.URL location, java.util.Map<java.lang.String,java.lang.String> properties)Constructs aHeaderobject pointing to a license template file. In case of the template contains replaceable values (declared as ${valuename}), you can set the map of this values.- Parameters:
location- The license template file location.properties- The map of values to replace.- Throws:
java.lang.IllegalArgumentException- If the header file location is null or if an error occurred while reading the file content.
-
-
Method Detail
-
asString
public java.lang.String asString()
-
asOneLineString
public java.lang.String asOneLineString()
-
getLineCount
public int getLineCount()
-
getLocation
public java.net.URL getLocation()
Returns the location of license template file.- Returns:
- The URL location.
-
eol
public java.lang.String eol(boolean unix)
-
buildForDefinition
public java.lang.String buildForDefinition(HeaderDefinition type, boolean unix)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getLines
public java.lang.String[] getLines()
-
notEmpty
private boolean notEmpty(java.lang.String str)
-
-