- java.lang.Object
-
- org.scijava.types.Nil<T>
-
- All Implemented Interfaces:
GenericTyped,Proxyable<T>
public abstract class Nil<T> extends Object implements GenericTyped, Proxyable<T>
A "typed null" which knows its generic type, and can generate proxy objects implementing that type's interfaces, with customizable behavior per interface method via callbacks.The term "nil" was chosen, despite lots of possibility for confusion with related paradigms such as the Scala language, because it is very short while loosely meaning the same thing as
null,None, etc.- Author:
- Curtis Rueden
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Nil<T>of(Class<T> rawType)static Nil<?>of(Type type)Creates aNilof the given genericType, with no extra method callbacks.static Nil<?>of(Type type, Object callbacks)Creates aNilof the givenType, with extra method callbacks contained in the specified object.Tproxy()Create a proxy which implements all the same interfaces as this object's generic type.StringtoString()Typetype()
-
-
-
Constructor Detail
-
Nil
public Nil()
Creates a newNilwhose generic type (returned bytype()) is the one specified by the generic parameters used at construction.For example:
Nil<List<Map<K, V>>> nil = new Nil<List<Map<K, V>>>() {};Subsequent calls to
nil.type()will return the proper generically typed result—in the above example, aParameterizedTypewhose raw type isList, and whose single type parameter is aParameterizedTypewith raw type ofMapandTypeVariabletype parameters ofKandVrespectively, including their bounds inferred by the compiler in the context where the expression was written.
-
Nil
public Nil(Object callbacks)
-
-
Method Detail
-
of
public static Nil<?> of(Type type)
Creates aNilof the given genericType, with no extra method callbacks.
-
of
public static Nil<?> of(Type type, Object callbacks)
Creates aNilof the givenType, with extra method callbacks contained in the specified object.
-
type
public Type type()
- Specified by:
typein interfaceGenericTyped
-
-