Applying Hendrik Maryns' generics changes for Entities + Validate from LANG-336
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@770891 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8b7956d27f
commit
73ac4a0289
|
@ -749,8 +749,8 @@ class Entities {
|
||||||
* array of entities to be added
|
* array of entities to be added
|
||||||
*/
|
*/
|
||||||
public void addEntities(String[][] entityArray) {
|
public void addEntities(String[][] entityArray) {
|
||||||
for (int i = 0; i < entityArray.length; ++i) {
|
for (String[] element : entityArray) {
|
||||||
addEntity(entityArray[i][0], Integer.parseInt(entityArray[i][1]));
|
addEntity(element[0], Integer.parseInt(element[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,9 +258,7 @@ public class Validate {
|
||||||
* @throws IllegalArgumentException if the array is empty
|
* @throws IllegalArgumentException if the array is empty
|
||||||
*/
|
*/
|
||||||
public static void notEmpty(Object[] array) {
|
public static void notEmpty(Object[] array) {
|
||||||
if (array == null || array.length == 0) {
|
notEmpty(array, "The validated array is empty");
|
||||||
throw new IllegalArgumentException("The validated array is empty");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// notEmpty collection
|
// notEmpty collection
|
||||||
|
@ -278,7 +276,7 @@ public class Validate {
|
||||||
* @param message the exception message you would like to see if the collection is empty
|
* @param message the exception message you would like to see if the collection is empty
|
||||||
* @throws IllegalArgumentException if the collection is empty
|
* @throws IllegalArgumentException if the collection is empty
|
||||||
*/
|
*/
|
||||||
public static void notEmpty(Collection collection, String message) {
|
public static void notEmpty(Collection<?> collection, String message) {
|
||||||
if (collection == null || collection.size() == 0) {
|
if (collection == null || collection.size() == 0) {
|
||||||
throw new IllegalArgumentException(message);
|
throw new IllegalArgumentException(message);
|
||||||
}
|
}
|
||||||
|
@ -297,10 +295,8 @@ public class Validate {
|
||||||
* @param collection the collection to check is not empty
|
* @param collection the collection to check is not empty
|
||||||
* @throws IllegalArgumentException if the collection is empty
|
* @throws IllegalArgumentException if the collection is empty
|
||||||
*/
|
*/
|
||||||
public static void notEmpty(Collection collection) {
|
public static void notEmpty(Collection<?> collection) {
|
||||||
if (collection == null || collection.size() == 0) {
|
notEmpty(collection, "The validated collection is empty");
|
||||||
throw new IllegalArgumentException("The validated collection is empty");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// notEmpty map
|
// notEmpty map
|
||||||
|
@ -318,7 +314,7 @@ public class Validate {
|
||||||
* @param message the exception message you would like to see if the map is empty
|
* @param message the exception message you would like to see if the map is empty
|
||||||
* @throws IllegalArgumentException if the map is empty
|
* @throws IllegalArgumentException if the map is empty
|
||||||
*/
|
*/
|
||||||
public static void notEmpty(Map map, String message) {
|
public static void notEmpty(Map<?,?> map, String message) {
|
||||||
if (map == null || map.size() == 0) {
|
if (map == null || map.size() == 0) {
|
||||||
throw new IllegalArgumentException(message);
|
throw new IllegalArgumentException(message);
|
||||||
}
|
}
|
||||||
|
@ -337,10 +333,8 @@ public class Validate {
|
||||||
* @param map the map to check is not empty
|
* @param map the map to check is not empty
|
||||||
* @throws IllegalArgumentException if the map is empty
|
* @throws IllegalArgumentException if the map is empty
|
||||||
*/
|
*/
|
||||||
public static void notEmpty(Map map) {
|
public static void notEmpty(Map<?,?> map) {
|
||||||
if (map == null || map.size() == 0) {
|
notEmpty(map, "The validated map is empty");
|
||||||
throw new IllegalArgumentException("The validated map is empty");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// notEmpty string
|
// notEmpty string
|
||||||
|
@ -378,9 +372,7 @@ public class Validate {
|
||||||
* @throws IllegalArgumentException if the string is empty
|
* @throws IllegalArgumentException if the string is empty
|
||||||
*/
|
*/
|
||||||
public static void notEmpty(String string) {
|
public static void notEmpty(String string) {
|
||||||
if (string == null || string.length() == 0) {
|
notEmpty(string, "The validated string is empty");
|
||||||
throw new IllegalArgumentException("The validated string is empty");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// notNullElements array
|
// notNullElements array
|
||||||
|
|
Loading…
Reference in New Issue