com.atlassian.bamboo.util
Class Narrow

java.lang.Object
  extended by com.atlassian.bamboo.util.Narrow

public class Narrow
extends java.lang.Object

Utility for narrowing object instances to Class types See to(Object, Class)

Since:
2.7

Method Summary
static
<T> java.lang.Iterable<T>
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
<T> T
to(java.lang.Object o, java.lang.Class<T> aClass)
          Narrows the given Object to the type of the Class If object cannot be narrowed to the given type this method returns null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

to

@Nullable
public static <T> T to(@NotNull
                                java.lang.Object o,
                                @NotNull
                                java.lang.Class<T> aClass)
Narrows the given Object to the type of the Class If object cannot be narrowed to the given type this method returns null

Type Parameters:
T -
Parameters:
o -
aClass -
Returns:

iterableTo

public static <T> java.lang.Iterable<T> iterableTo(@NotNull
                                                   java.lang.Iterable<?> iterable,
                                                   @NotNull
                                                   java.lang.Class<T> aClass)
Filters given Iterable returning only these objects which could be narrowed to given type

Type Parameters:
T -
Parameters:
iterable - input iterable containing elements to filter
aClass - class used to narrow elements of iterable
Returns:
filtered iterable with non-null elements narrowed to aClass


Copyright © 2010 Atlassian. All Rights Reserved.