|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.senn.magic.util.GeneralUtils
public final class GeneralUtils
This class contains useful methods like conversion from an array
to a List, etc.
| Method Summary | ||
|---|---|---|
static
|
addIfNotNull(Collection<S> collection,
S o)
Method that adds an object to a Collection if that object is not null. |
|
static
|
asArrayList(S[] array)
Generic method to create an ArrayList of an array of objects. |
|
static boolean |
canBeBoolean(String value)
Checks if a String value can be cast to a an int or Integer |
|
static boolean |
canBeByte(String value)
Checks if a String value can be cast to a byte or Byte |
|
static boolean |
canBeDouble(String value)
Checks if a String value can be cast to a double or Double |
|
static boolean |
canBeFloat(String value)
Checks if a String value can be cast to a float or Float |
|
static boolean |
canBeInteger(String value)
Checks if a String value can be cast to an int or Integer |
|
static boolean |
canBeLong(String value)
Checks if a String value can be cast to a long or Long |
|
static boolean |
canBeShort(String value)
Checks if a String value can be cast to a short or Short |
|
static
|
convertToOutputStream(InputStream in,
Class<S> outClass)
Generic method that converts an InputStream to an OutputStream of choice. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <S> ArrayList<S> asArrayList(S[] array)
ArrayList of an array of objects. List, but not the other way around.
array - an array containing your items
ArrayList - an ArrayList containing your items.public static boolean canBeInteger(String value)
String value can be cast to an int or Integer
value -
boolean - true if it's possible, false if notpublic static boolean canBeLong(String value)
String value can be cast to a long or Long
value -
boolean - true if it's possible, false if notpublic static boolean canBeDouble(String value)
String value can be cast to a double or Double
value -
boolean - true if it's possible, false if notpublic static boolean canBeShort(String value)
String value can be cast to a short or Short
value -
boolean - true if it's possible, false if notpublic static boolean canBeFloat(String value)
String value can be cast to a float or Float
value -
boolean - true if it's possible, false if notpublic static boolean canBeByte(String value)
String value can be cast to a byte or Byte
value -
boolean - true if it's possible, false if notpublic static boolean canBeBoolean(String value)
String value can be cast to a an int or Integer
value -
boolean - true if it's possible, false if not
public static <S extends OutputStream> S convertToOutputStream(InputStream in,
Class<S> outClass)
throws Exception
InputStream to an OutputStream of choice.
OutputStream.
in - an instance of any subclass of InputStreamoutClass - a subclass of OutputStream
Exception
public static <S> boolean addIfNotNull(Collection<S> collection,
S o)
Collection if that object is not null.
collection - the collection to add the item too - the item to add if not null
boolean - true if the item was not null and it was successfully added to the collection,
false if the item was null or if it could not be added to the collection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||