|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.api.common.Args
public class Args
Utility class used to validate arguments and configuration options passed to objects in uniVocity's API.
| Constructor Summary | |
|---|---|
protected |
Args()
Protected to allow subclassing |
| Method Summary | ||
|---|---|---|
static String |
decode(Object value)
Decodes a URL encoded value using UTF-8. |
|
static String |
decode(Object value,
String charsetName)
Decodes a URL encoded value. |
|
static String |
decode(String parameterName,
Object value,
String charsetName)
Decodes a URL encoded value. |
|
static String |
encode(Object parameterValue)
Encodes a value using UTF-8 so it can be used as part of a URL. |
|
static String |
encode(Object parameterValue,
String charsetName)
Encodes a value so it can be used as part of a URL. |
|
static String |
encode(String parameterName,
Object parameterValue,
String charsetName)
Encodes a value so it can be used as part of a URL. |
|
static boolean |
equals(Collection<Object[]> c1,
Collection<Object[]> c2)
Determines whether two collections of Object[] contain the same values. |
|
static String |
guessAndValidateName(String name,
File file,
String fieldName)
Attempts to discover the plain name of a given file, without directories or its extension |
|
static boolean |
isBlank(String s)
Tests if a given String is null/empty/blank/ |
|
static boolean |
isNotBlank(String s)
Tests if a given String is not null/empty/blank/ |
|
static Calendar |
isoDateStringToCalendar(String s)
Converts a yyyy-MM-dd formatted string to a Calendar instance. |
|
static void |
noBlanks(Object[] o,
String fieldName)
Ensures the elements in a given array are not null/empty/blank. |
|
static
|
noneEmpty(Collection<T> elements,
String fieldName)
Ensures a given collection is not null/empty and doesn't contain null/empty objects or blank Strings |
|
static void |
notBlank(CharSequence o,
String fieldName)
Ensures a given CharSequence argument is not null/empty/blank |
|
static void |
notEmpty(char[] field,
String fieldName)
Ensures a given char array argument is not null/empty |
|
static void |
notEmpty(CharSequence o,
String fieldName)
Ensures a given CharSequence argument is not null/empty |
|
static void |
notEmpty(Collection<?> field,
String fieldName)
Ensures a given collection is not null/empty |
|
static void |
notEmpty(int[] field,
String fieldName)
Ensures a given int[] array argument is not null/empty |
|
static
|
notEmpty(T[] sequence,
String fieldName)
Ensures a given array argument is not null/empty and no elements are null/empty |
|
static void |
notNull(Object o,
String fieldName)
Ensures a given argument is not null. |
|
static void |
positive(Number o,
String fieldName)
Ensures a given number is positive (and greater than zero). |
|
static void |
positiveOrZero(Number o,
String fieldName)
Ensures a given number is positive or equal to zero. |
|
static String |
replaceSystemProperties(String string)
Replaces system properties between { and } in a given String with the property values, and returns the result. |
|
static void |
validFile(File file,
String fieldName)
Ensures a given File argument is not null, exists and does not point to a directory |
|
static void |
validTransactionIsolationLevel(int transactionIsolationLevel)
Ensures a given SQL isolation level is a valid and known JDBC value that exists int Connection |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Args()
| Method Detail |
|---|
public static final void notNull(Object o,
String fieldName)
o - the object to validatefieldName - the description of the field
public static final void positive(Number o,
String fieldName)
o - the number to validatefieldName - the description of the field
public static final void positiveOrZero(Number o,
String fieldName)
o - the number to validatefieldName - the description of the field
public static <T> void notEmpty(T[] sequence,
String fieldName)
T - the type of elements in the arraysequence - the array of objectsfieldName - the description of the field
public static void notEmpty(Collection<?> field,
String fieldName)
field - the collection of objectsfieldName - the description of the field
public static <T> void noneEmpty(Collection<T> elements,
String fieldName)
T - the type of elements in the collectionelements - the collection of objectsfieldName - the description of the field
public static final void notEmpty(int[] field,
String fieldName)
field - the array of objectsfieldName - the description of the field
public static final void notEmpty(char[] field,
String fieldName)
char array argument is not null/empty
field - the array of objectsfieldName - the description of the field
public static final void notEmpty(CharSequence o,
String fieldName)
CharSequence argument is not null/empty
o - a character sequencefieldName - the description of the field
public static final void notBlank(CharSequence o,
String fieldName)
CharSequence argument is not null/empty/blank
o - a character sequencefieldName - the description of the field
public static final void noBlanks(Object[] o,
String fieldName)
o - the array of elements to be validated.fieldName - description of the array.
public static final void validFile(File file,
String fieldName)
File argument is not null, exists and does not point to a directory
file - a filefieldName - the description of the fieldpublic static final void validTransactionIsolationLevel(int transactionIsolationLevel)
Connection
transactionIsolationLevel - code of the transaction isolation level
public static final String guessAndValidateName(String name,
File file,
String fieldName)
name - a name if known. Will be returned if provided.file - a file whose path will be analyzed in order to extract a name fromfieldName - name of field associated with the file name. Used for validation messages only
IllegalArgumentException will be thrownpublic static final boolean isBlank(String s)
String is null/empty/blank/
s - the string
true if the given String is null, empty or blank, otherwise returns falsepublic static final boolean isNotBlank(String s)
String is not null/empty/blank/
s - the string
true if the given String is not null, empty or blank, otherwise returns falsepublic static final String replaceSystemProperties(String string)
String with the property values, and returns the result.
Unknown properties won't be replaced.
string - the String with potential system properties.
String with all known system properties replaced.public static final String decode(Object value)
value - the value to be decoded.
public static final String decode(Object value,
String charsetName)
value - the value to be decoded.charsetName - the charset to use for decoding the given value. If null, then UTF-8 will be used.
public static final String decode(String parameterName,
Object value,
String charsetName)
parameterName - name of the parameter associated with the valuevalue - the value to be decoded.charsetName - the charset to use for decoding the given value. If null, then UTF-8 will be used.
public static final String encode(Object parameterValue)
String
representation will be returned.
parameterValue - the value to be encoded.
public static final String encode(Object parameterValue,
String charsetName)
String
representation will be returned.
parameterValue - the value to be encoded.charsetName - charset to use for encoding the given value. If null, then UTF-8 will be used.
public static final String encode(String parameterName,
Object parameterValue,
String charsetName)
String
representation will be returned.
parameterName - name of the parameter associated with the valueparameterValue - the value to be encoded.charsetName - charset to use for encoding the given value. If null, then UTF-8 will be used.
public static final Calendar isoDateStringToCalendar(String s)
s - the yyyy-MM-dd formatted string
Calendar instance
public static boolean equals(Collection<Object[]> c1,
Collection<Object[]> c2)
c1 - the first collectionc2 - the second collection.
true if both collections contain the same values, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||