Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
Modifier and Type | Method and Description |
---|---|
static String |
calcTime(long totalTime)
Calculate time from milliseconds
|
static String |
cleanData(String origStr)
Removes trailing characters (space, comma, slash, semicolon, colon),
trailing period if it is preceded by at least three letters,
and single square bracket characters if they are the start and/or end
chars of the cleaned string
|
static String |
cleanDate(String date)
Cleans non-digits from a String
|
static char |
foldDiacriticLatinChar(char c)
given a latin letter with a diacritic, return the latin letter without
the diacritic.
|
static Set<String> |
getAllSubfields(org.marc4j.marc.Record record,
String[] tags)
For each occurrence of a marc field in the tags list, extract all
subfield data from the field, place it in a single string (individual
subfield data separated by spaces) and add the string to the result set.
|
static int |
getIxUnescapedComma(String str)
return the index within this string of the first occurrence of a comma
that isn't escaped with a backslash.
|
static int |
getIxUnescapedOpenParen(String str)
return the index within this string of the first occurrence of an open
parenthesis that isn't escaped with a backslash.
|
static Set<String> |
getPrefixedVals(Set<String> valueSet,
String prefix)
Look for Strings in the set, that start with the given prefix.
|
static String |
getProperty(Properties props,
String propname)
Check first for a particular property in the System Properties, so that the -Dprop="value" command line arg
mechanism can be used to override values defined in the passed in property file.
|
static String |
getProperty(Properties props,
String propname,
String defVal)
Check first for a particular property in the System Properties, so that the -Dprop="value" command line arg
mechanism can be used to override values defined in the passed in property file.
|
static String |
getPropertyFileAbsoluteURL(String[] propertyPaths,
String propertyFileName,
boolean showName,
String[] inputSource) |
static InputStream |
getPropertyFileInputStream(String propertyFileURLStr) |
static InputStream |
getPropertyFileInputStream(String[] propertyPaths,
String propertyFileName) |
static InputStream |
getPropertyFileInputStream(String[] propertyPaths,
String propertyFileName,
boolean showName) |
static InputStream |
getPropertyFileInputStream(String[] propertyPaths,
String propertyFileName,
boolean showName,
String[] inputSource) |
static String |
getSubfieldData(org.marc4j.marc.DataField df,
char code)
get the contents of a subfield, rigorously ensuring no NPE
|
static List<String> |
getSubfieldStrings(org.marc4j.marc.DataField df,
char code)
returns all values of subfield strings of a particular code
contained in the data field
|
static boolean |
isNumber(String number)
Test if a String has a numeric equivalent
|
static boolean |
isRightToLeftLanguage(String langcode)
returns true if the 3 letter language code is for a right to left
language (one written in arabic or hebrew characters)
|
static String |
join(Set<String> set,
String separator)
Join two fields together with seperator
|
static Properties |
loadProperties(String fullFilenameURLStr)
load a properties file into a Properties object
|
static Properties |
loadProperties(String[] propertyPaths,
String propertyFileName)
load a properties file into a Properties object
|
static Properties |
loadProperties(String[] propertyPaths,
String propertyFileName,
boolean showName)
load a properties file into a Properties object
|
static Properties |
loadProperties(String[] propertyPaths,
String propertyFileName,
boolean showName,
String filenameProperty)
load a properties file into a Properties object
|
static String |
readStreamIntoString(InputStream stream)
Takes an InputStream, reads the entire contents into a String
|
static Set<String> |
remap(Set<String> set,
Map<String,String> map,
boolean allowDefault)
Remap a set of field values.
|
static String |
remap(String fieldVal,
Map<String,String> map,
boolean allowDefault)
Remap a field value.
|
static String |
removeAllTrailingCharAndPeriod(String origStr,
String trailingCharsRegEx,
String charsB4periodRegEx)
Repeatedly removes trailing characters indicated in regular expression,
PLUS trailing period if it is preceded by its regular expression
|
static String |
removeOuterBrackets(String origStr)
Remove single square bracket characters if they are the start and/or end
chars (matched or unmatched) and are the only square bracket chars in
the string.
|
static String |
removePrefix(String value,
String prefix)
remove prefix from the beginning of the value string.
|
static String |
removeTrailingChar(String origStr,
String charsToReplaceRegEx)
Remove the characters per the regular expression if they are at the end
of the string.
|
static String |
removeTrailingCharAndPeriod(String origStr,
String trailingCharsRegEx,
String charsB4periodRegEx)
Removes trailing characters indicated in regular expression, PLUS
trailing period if it is preceded by its regular expression.
|
static String |
removeTrailingPeriod(String origStr,
String precedingCharsRegEx)
If there is a period at the end of the string, remove the period if it is
immediately preceded by the regular expression
|
static Set<String> |
returnValidISBNs(Set<String> candidates)
returns the valid ISBN(s) from the set of candidate Strings
|
static boolean |
setItemContains(Set<String> set,
String pattern)
Test if a set contains a specified pattern
|
static Set<String> |
trimNearDuplicates(Set<String> locations) |
protected static org.slf4j.Logger logger
public static String getProperty(Properties props, String propname)
props
- - property set in which to look.propname
- - name of the property to lookup.public static String getProperty(Properties props, String propname, String defVal)
props
- - property set in which to look.propname
- - name of the property to lookup.defVal
- - the default value to use if property is not definedpublic static Properties loadProperties(String[] propertyPaths, String propertyFileName)
propertyPaths
- the directories to search for the properties filepropertyFileName
- name of the sought properties filepublic static Properties loadProperties(String[] propertyPaths, String propertyFileName, boolean showName)
propertyPaths
- the directories to search for the properties filepropertyFileName
- name of the sought properties filepublic static Properties loadProperties(String fullFilenameURLStr)
fullFilenameURLStr
- String representation of url to properties file whether it is in a local file or a resourcepublic static Properties loadProperties(String[] propertyPaths, String propertyFileName, boolean showName, String filenameProperty)
propertyPaths
- the directories to search for the properties filepropertyFileName
- name of the sought properties fileshowName
- whether the name of the file/resource being read should be shown.public static InputStream getPropertyFileInputStream(String[] propertyPaths, String propertyFileName)
public static InputStream getPropertyFileInputStream(String[] propertyPaths, String propertyFileName, boolean showName)
public static InputStream getPropertyFileInputStream(String propertyFileURLStr)
public static InputStream getPropertyFileInputStream(String[] propertyPaths, String propertyFileName, boolean showName, String[] inputSource)
public static String getPropertyFileAbsoluteURL(String[] propertyPaths, String propertyFileName, boolean showName, String[] inputSource)
public static String readStreamIntoString(InputStream stream) throws IOException
stream
- - the stream to read in.IOException
public static String cleanDate(String date)
date
- String to parsepublic static String cleanData(String origStr)
origStr
- String to cleanpublic static String removeAllTrailingCharAndPeriod(String origStr, String trailingCharsRegEx, String charsB4periodRegEx)
origStr
- String to cleantrailingCharsRegEx
- a regular expression of trailing chars to be
removed (see java Pattern class). Note that the regular expression
should NOT have '$' at the end.
(e.g. " *[,/;:]" replaces any commas, slashes, semicolons or colons
at the end of the string, and these chars may optionally be preceded
by a space)charsB4periodRegEx
- a regular expression that must immediately
precede a trailing period IN ORDER FOR THE PERIOD TO BE REMOVED.
Note that the regular expression will NOT have the period or '$' at
the end.
(e.g. "[a-zA-Z]{3,}" means at least three letters must immediately
precede the period for it to be removed.)public static String removeTrailingCharAndPeriod(String origStr, String trailingCharsRegEx, String charsB4periodRegEx)
origStr
- String to cleantrailingCharsRegEx
- a regular expression of trailing chars to be
removed (see java Pattern class). Note that the regular expression
should NOT have '$' at the end.
(e.g. " *[,/;:]" replaces any commas, slashes, semicolons or colons
at the end of the string, and these chars may optionally be preceded
by a space)charsB4periodRegEx
- a regular expression that must immediately
precede a trailing period IN ORDER FOR THE PERIOD TO BE REMOVED.
Note that the regular expression will NOT have the period or '$' at
the end.
(e.g. "[a-zA-Z]{3,}" means at least three letters must immediately
precede the period for it to be removed.)public static String removeTrailingChar(String origStr, String charsToReplaceRegEx)
origStr
- string to be cleanedcharsToReplaceRegEx
- - a regular expression of the trailing string/chars
to be removed e.g. " *([,/;:])" meaning last character is a comma,
slash, semicolon, colon, possibly preceded by one or more spaces.class in java api
public static String removeTrailingPeriod(String origStr, String precedingCharsRegEx)
origStr
- the string to be cleanedcharsB4periodRegEx
- a regular expression that must immediately
precede a trailing period IN ORDER FOR THE PERIOD TO BE REMOVED.
Note that the regular expression will NOT have the period or '$' at
the end.
(e.g. "[a-zA-Z]{3,}" means at least three letters must immediately
precede the period for it to be removed.)public static String removeOuterBrackets(String origStr)
public static String calcTime(long totalTime)
totalTime
- Time in millisecondspublic static boolean isNumber(String number)
number
- String representation of a numberpublic static String remap(String fieldVal, Map<String,String> map, boolean allowDefault)
fieldVal
- - the raw value to be mappedmap
- - the map to be usedallowDefault
- - if "displayRawIfMissing" is not a key in the map,
and this is to true, then if the map contains "__DEFAULT" as a key,
the value of "__DEFAULT" in the map is used.public static Set<String> remap(Set<String> set, Map<String,String> map, boolean allowDefault)
fieldVal
- - the raw value to be mappedmap
- - the map to be usedallowDefault
- - if "displayRawIfMissing" is not a key in the map,
and this is to true, then if the map contains "__DEFAULT" as a key,
the value of "__DEFAULT" in the map is used.public static boolean setItemContains(Set<String> set, String pattern)
set
- Set of marc fields to testpattern
- Regex String pattern to matchpublic static String join(Set<String> set, String separator)
set
- Set of marc fields to joinseparator
- Separation character to put betweenpublic static Set<String> trimNearDuplicates(Set<String> locations)
public static final boolean isRightToLeftLanguage(String langcode)
langcode
- public static final int getIxUnescapedOpenParen(String str)
str
- public static final int getIxUnescapedComma(String str)
str
- public static final Set<String> getPrefixedVals(Set<String> valueSet, String prefix)
valueSet
- prefix
- public static final String removePrefix(String value, String prefix)
public static Set<String> returnValidISBNs(Set<String> candidates)
public static final Set<String> getAllSubfields(org.marc4j.marc.Record record, String[] tags)
public static final String getSubfieldData(org.marc4j.marc.DataField df, char code)
df
- - DataField of interestcode
- - code of subfield of interestpublic static final List<String> getSubfieldStrings(org.marc4j.marc.DataField df, char code)
public static char foldDiacriticLatinChar(char c)
Copyright © 2004–2015 The Kuali Foundation. All rights reserved.