Class Interfaces
java.lang.Object
org.soliscode.test.interfaces.Interfaces
Utility class that helps create interface-narrowing views on objects.
- Since:
- 1.0
- Author:
- evanbergstrom
-
Method Summary
Modifier and TypeMethodDescriptionstatic <E> CollectionOnly
<E> narrowToCollection
(Collection<E> i) Wraps the object so that only the methods in theCollection
interface are available.static <E> IterableOnly
<E> narrowToIterable
(Iterable<E> i) Wraps the object so that only the methods in theIterable
interface are available.static NumberOnly
Wraps the object so that only the methods in theNumber
interface are available.static ObjectOnly
narrowToObject
(@NotNull Object obj) Wraps the object so that only the methods in theObject
interface are available.
-
Method Details
-
narrowToObject
Wraps the object so that only the methods in theObject
interface are available.- Parameters:
obj
- the object to wrap.- Returns:
- the wrapped object.
-
narrowToNumber
Wraps the object so that only the methods in theNumber
interface are available.- Parameters:
n
- the number to wrap.- Returns:
- the wrapped number.
-
narrowToIterable
Wraps the object so that only the methods in theIterable
interface are available.- Type Parameters:
E
- the element type for the iterable.- Parameters:
i
- the iterable to wrap- Returns:
- the wrapped iterable.
-
narrowToCollection
Wraps the object so that only the methods in theCollection
interface are available.- Type Parameters:
E
- the element type for the iterable.- Parameters:
i
- the iterable to wrap- Returns:
- the wrapped iterable.
-