|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.bamboo.util.Narrow
public class Narrow
Utility for narrowing object instances to Class
types
See to(Object, Class)
Method Summary | ||
---|---|---|
static
|
downTo(X o,
java.lang.Class<T> aClass)
Should be used for casting down the hierarchy of classes. |
|
static
|
iterableTo(java.lang.Iterable<?> iterable,
java.lang.Class<T> aClass)
Filters given Iterable returning only these objects which could be narrowed to given type |
|
static
|
reinterpret(java.lang.Object o,
java.lang.Class<T> aClass)
Narrows the given Object to the type of the Class . |
|
static
|
to(java.lang.Object o,
java.lang.Class<T> aClass)
Narrows the given Object to the type of the Class . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
@Nullable public static <T> T reinterpret(@Nullable java.lang.Object o, @NotNull java.lang.Class<T> aClass)
Object
to the type of the Class
. Using $downTo(Object, Class)
is always preferred over using this method.
If object cannot be narrowed to the given type this method returns null
This is a non-throwing form of Class.cast(Object)
T
- the type to be narrowed too
- the object to be narrowed. This object can be a null referenceaClass
- the class to narrow to
@Nullable public static <T> T to(@Nullable java.lang.Object o, @NotNull java.lang.Class<T> aClass)
Object
to the type of the Class
. Using $downTo(Object, Class)
is always preferred over using this method.
If object cannot be narrowed to the given type this method returns null
This is a non-throwing form of Class.cast(Object)
T
- the type to be narrowed too
- the object to be narrowed. This object can be a null referenceaClass
- the class to narrow to
@Nullable public static <X,T extends X> T downTo(@Nullable X o, @NotNull java.lang.Class<T> aClass)
to(Object, Class)
.
public static <T> java.lang.Iterable<T> iterableTo(@NotNull java.lang.Iterable<?> iterable, @NotNull java.lang.Class<T> aClass)
T
- iterable
- input iterable containing elements to filteraClass
- class used to narrow elements of iterable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |