public final class ParsingUtils
extends java.lang.Object
| Constructor and Description |
|---|
ParsingUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
assertFieldHasContent(java.lang.String field,
java.lang.String value)
Asserts that a specified field contains a non-null, non-empty value.
|
static boolean |
checkAndLogIfNoContent(java.lang.String sampleId,
java.lang.String field,
java.lang.String value)
Checks if the specified sample property value is null or empty, and logs
it as missing if it is.
|
static boolean |
fileMatchesExtension(java.io.File file,
java.lang.String targetExtension)
Determine if a given file matches the target extension.
|
static java.lang.String |
formatSampleText(java.util.List<java.lang.String> lines,
int maxTrim)
Formats a section of sample text by removing leading whitespace
characters up to a given maximum and by flattening lines into a single
string.
|
static int |
getLeadingWhitespace(java.lang.String str)
Returns the number of leading whitespace characters in a given string.
|
static int |
getMinWhitespace(java.util.List<java.lang.String> lines)
Gets the minimum amount of leading whitespace in a text block.
|
static java.lang.String |
trimLeadingWhitespace(java.lang.String str,
int max)
Trims up to a certain number of leading whitespace characters from a
string.
|
public static boolean fileMatchesExtension(java.io.File file,
java.lang.String targetExtension)
file - file to checktargetExtension - target extensionpublic static java.lang.String formatSampleText(java.util.List<java.lang.String> lines,
int maxTrim)
lines - list where each element represents an individual line of
sample textmaxTrim - maximum number of leading whitespace characters to trim from
each linepublic static int getMinWhitespace(java.util.List<java.lang.String> lines)
lines - list where each element represents an individual line of
sample textpublic static int getLeadingWhitespace(java.lang.String str)
str - string to checkpublic static java.lang.String trimLeadingWhitespace(java.lang.String str,
int max)
str - string to processmax - maximum number of whitespace characters to trimpublic static java.lang.String assertFieldHasContent(java.lang.String field,
java.lang.String value)
field - name of fieldvalue - value from fieldpublic static boolean checkAndLogIfNoContent(java.lang.String sampleId,
java.lang.String field,
java.lang.String value)
sampleId - The sampleIdfield - name of fieldvalue - value of fieldCopyright © 2017. All Rights Reserved.