Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 1.07 KB

File metadata and controls

23 lines (14 loc) · 1.07 KB

SciJava Types: A library for generic type reasoning

This library provides a suite of utilities for working with generic types in Java.

TypeService and TypeExtractors: an extensible system for discovering generic types

TypeService.reify() offers provides a powerful, extensible way to determine the generic type for, or "reify", a given Object. Under the hood, it relies on TypeExtractor implementations, allowing the user to extend its capabilities by defining new implementations.

Also of note is the interface GenericTyped, which can be implemented to quickly make any type reifiable.

Nil: a container Object able to specify generic Types

Nils can best be described as a "typed null", able to generate a generic type defined by the Nil's type parameter. Given a generic type X, we can create a Type instance of X using the code

Type x = new Nil<X>() {}.getType();

For example, if we wanted to specify the type Function<Double, Double>, we could write

Type functionType = new Nil<Function<Double, Double>>() {}.getType();