public final class HeaderDefinition extends Object
HeaderDefinition class defines what is needed to output a header text into the of the given file
type and what is needed to match the first line as well as the last line of a previous header of the given file
type.| Constructor and Description |
|---|
HeaderDefinition(String type)
Constructs a new
HeaderDefinition with only initializing the header type. |
HeaderDefinition(String type,
String firstLine,
String beforeEachLine,
String endLine,
String skipLinePattern,
String firstLineDetectionPattern,
String lastLineDetectionPattern,
boolean allowBlankLines,
boolean isMultiline)
Constructs a new
HeaderDefinition object with every header definition properties. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allowBlankLines() |
boolean |
equals(Object o) |
String |
getBeforeEachLine() |
String |
getEndLine() |
String |
getFirstLine() |
protected Pattern |
getSkipLinePattern() |
String |
getType() |
int |
hashCode() |
boolean |
isFirstHeaderLine(String line)
Tells if the given content line is the first line of a possible header of this definition kind.
|
boolean |
isLastHeaderLine(String line)
Tells if the given content line is the last line of a possible header of this definition kind.
|
boolean |
isMultiLine() |
boolean |
isSkipLine(String line)
Tells if the given content line must be skipped according to this header definition.
|
void |
setPropertyFromString(String property,
String value)
Sets header definition properties using its property name and its string value.
If you want to set a property to null you must not call this function. This function is mainly used while parsing properties from the XML configuration file. |
String |
toString() |
void |
validate()
Checks this header definition consistency, in other words if all the mandatory properties of the definition have
been set.
|
public HeaderDefinition(String type, String firstLine, String beforeEachLine, String endLine, String skipLinePattern, String firstLineDetectionPattern, String lastLineDetectionPattern, boolean allowBlankLines, boolean isMultiline)
HeaderDefinition object with every header definition properties.type - The type name for this header definition.firstLine - The string to output before the content of the first line of this header.beforeEachLine - The string to output before the content of each line of this header (except
firstLine and endLine).endLine - The string to output before the content of the last line of this header.skipLinePattern - The pattern of lines to skip before being allowed to output this header or null
if it can be outputted from the line of the file.firstLineDetectionPattern - The pattern to detect the first line of a previous header.lastLineDetectionPattern - The pattern to detect the last line of a previous header.IllegalArgumentException - If the type name is null.public HeaderDefinition(String type)
HeaderDefinition with only initializing the header type. You must then set all the
other definitions properties manually in order to have a coherent object.type - The type name for this header definition.IllegalArgumentException - If the type name is null.check(String, String),
setPropertyFromString(String, String)public String getFirstLine()
public String getBeforeEachLine()
public String getEndLine()
public String getType()
public boolean allowBlankLines()
public boolean isSkipLine(String line)
line - The line to test.public boolean isFirstHeaderLine(String line)
line - The line to test.public boolean isLastHeaderLine(String line)
line - The line to test.protected Pattern getSkipLinePattern()
public void setPropertyFromString(String property, String value)
property - The property name.value - The property value.IllegalArgumentException - If the property value is null.public void validate()
IllegalStateException - If a mandatory property has not been set.public boolean isMultiLine()
Copyright © 2008-2012 Mathieu Carbou. All Rights Reserved.