public abstract class AbstractLicenseAppender
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
DOT |
private static int[] |
EXPECTS_AT_ECHO |
private static int[] |
EXPECTS_HASH_PLING |
private static int[] |
EXPECTS_MSVSSF_HEADER |
private static int[] |
EXPECTS_PACKAGE |
private static int[] |
EXPECTS_PHP_PI |
private static int[] |
EXPECTS_XML_DECL |
private static java.util.Map<java.lang.String,java.lang.Integer> |
EXT2TYPE |
private static int[] |
FAMILY_APT |
private static int[] |
FAMILY_BAT |
private static int[] |
FAMILY_C |
private static int[] |
FAMILY_SGML |
private static int[] |
FAMILY_SH |
private static int[] |
FAMILY_VELOCITY |
private boolean |
isForced |
private static java.lang.String |
LINE_SEP
the line separator for this OS
|
private static int |
TYPE_APT |
private static int |
TYPE_BAT |
private static int |
TYPE_BEANSHELL |
private static int |
TYPE_C |
private static int |
TYPE_CPP |
private static int |
TYPE_CSHARP |
private static int |
TYPE_CSS |
private static int |
TYPE_FML |
private static int |
TYPE_GO |
private static int |
TYPE_GROOVY |
private static int |
TYPE_H |
private static int |
TYPE_HTML |
private static int |
TYPE_JAVA |
private static int |
TYPE_JAVASCRIPT |
private static int |
TYPE_JSP |
private static int |
TYPE_PERL |
private static int |
TYPE_PHP |
private static int |
TYPE_PM |
private static int |
TYPE_PROPERTIES |
private static int |
TYPE_PYTHON |
private static int |
TYPE_RUBY |
private static int |
TYPE_SCALA |
private static int |
TYPE_SH |
private static int |
TYPE_TCL |
private static int |
TYPE_UNKNOWN |
private static int |
TYPE_VISUAL_STUDIO_SOLUTION |
private static int |
TYPE_VM |
private static int |
TYPE_XML |
| Constructor and Description |
|---|
AbstractLicenseAppender() |
| Modifier and Type | Method and Description |
|---|---|
void |
append(java.io.File document)
Append the default license header to the supplied document.
|
private boolean |
attachLicense(java.io.Writer writer,
java.io.File document,
boolean expectsHashPling,
boolean expectsAtEcho,
boolean expectsPackage,
boolean expectsXMLDecl,
boolean expectsPhpPI,
boolean expectsMSVSSF)
Write document's content to writer attaching the license using
the given flags as hints for where to put it.
|
private void |
doFirstLine(java.io.File document,
java.io.Writer writer,
java.lang.String line,
java.lang.String lookfor)
Check first line for specified text and process.
|
private static boolean |
expectsAtEcho(int type) |
private static boolean |
expectsHashPling(int type) |
private static boolean |
expectsMSVisualStudioSolutionFileHeader(int type) |
private static boolean |
expectsPackage(int type) |
private static boolean |
expectsPhpPI(int type) |
private static boolean |
expectsXMLDecl(int type) |
protected java.lang.String |
getFirstLine(int type)
Get the first line of the license header formatted
for the given type of file.
|
protected java.lang.String |
getLastLine(int type)
Get the last line of the license header formatted
for the given type of file.
|
abstract java.lang.String |
getLicenseHeader(java.io.File document) |
protected java.lang.String |
getLine(int type,
java.lang.String content)
Get a line of the license header formatted
for the given type of file.
|
protected int |
getType(java.io.File document)
Detect the type of document.
|
private static boolean |
isFamilyAPT(int type) |
private static boolean |
isFamilyBAT(int type) |
private static boolean |
isFamilyC(int type) |
private static boolean |
isFamilySGML(int type) |
private static boolean |
isFamilySH(int type) |
private static boolean |
isFamilyVelocity(int type) |
private static boolean |
isIn(int[] arr,
int key) |
private java.lang.String |
passThroughReadNext(java.io.Writer writer,
java.lang.String line,
java.io.BufferedReader br) |
void |
setForce(boolean force)
Set the force flag on this appender.
|
private static final java.lang.String DOT
private static final int TYPE_UNKNOWN
private static final int TYPE_JAVA
private static final int TYPE_XML
private static final int TYPE_HTML
private static final int TYPE_CSS
private static final int TYPE_JAVASCRIPT
private static final int TYPE_APT
private static final int TYPE_PROPERTIES
private static final int TYPE_PYTHON
private static final int TYPE_C
private static final int TYPE_H
private static final int TYPE_SH
private static final int TYPE_BAT
private static final int TYPE_VM
private static final int TYPE_SCALA
private static final int TYPE_RUBY
private static final int TYPE_PERL
private static final int TYPE_TCL
private static final int TYPE_CPP
private static final int TYPE_CSHARP
private static final int TYPE_PHP
private static final int TYPE_GROOVY
private static final int TYPE_VISUAL_STUDIO_SOLUTION
private static final int TYPE_BEANSHELL
private static final int TYPE_JSP
private static final int TYPE_FML
private static final int TYPE_GO
private static final int TYPE_PM
private static final java.lang.String LINE_SEP
private static final int[] FAMILY_C
private static final int[] FAMILY_SGML
private static final int[] FAMILY_SH
private static final int[] FAMILY_BAT
private static final int[] FAMILY_APT
private static final int[] FAMILY_VELOCITY
private static final int[] EXPECTS_HASH_PLING
private static final int[] EXPECTS_AT_ECHO
private static final int[] EXPECTS_PACKAGE
private static final int[] EXPECTS_XML_DECL
private static final int[] EXPECTS_PHP_PI
private static final int[] EXPECTS_MSVSSF_HEADER
private static final java.util.Map<java.lang.String,java.lang.Integer> EXT2TYPE
private boolean isForced
public void append(java.io.File document)
throws java.io.IOException
document - document to append to.java.io.IOException - if there is a problem while reading or writing the fileprivate boolean attachLicense(java.io.Writer writer,
java.io.File document,
boolean expectsHashPling,
boolean expectsAtEcho,
boolean expectsPackage,
boolean expectsXMLDecl,
boolean expectsPhpPI,
boolean expectsMSVSSF)
throws java.io.IOException
java.io.IOExceptionprivate void doFirstLine(java.io.File document,
java.io.Writer writer,
java.lang.String line,
java.lang.String lookfor)
throws java.io.IOException
java.io.IOExceptionprotected int getType(java.io.File document)
document - to retrieve type from.public void setForce(boolean force)
force - force flag.public abstract java.lang.String getLicenseHeader(java.io.File document)
document - document to extract from.protected java.lang.String getFirstLine(int type)
type - the type of file, see the TYPE_* constantsprotected java.lang.String getLastLine(int type)
type - the type of file, see the TYPE_* constantsprotected java.lang.String getLine(int type,
java.lang.String content)
type - the type of file, see the TYPE_* constantscontent - the content for this lineprivate static boolean isFamilyC(int type)
private static boolean isFamilySGML(int type)
private static boolean isFamilySH(int type)
private static boolean isFamilyAPT(int type)
private static boolean isFamilyBAT(int type)
private static boolean isFamilyVelocity(int type)
private static boolean expectsHashPling(int type)
private static boolean expectsAtEcho(int type)
private static boolean expectsPackage(int type)
private static boolean expectsXMLDecl(int type)
private static boolean expectsPhpPI(int type)
private static boolean expectsMSVisualStudioSolutionFileHeader(int type)
private static boolean isIn(int[] arr,
int key)
private java.lang.String passThroughReadNext(java.io.Writer writer,
java.lang.String line,
java.io.BufferedReader br)
throws java.io.IOException
java.io.IOException