public class Singleton extends Object
final String url = "https://janelia-cosem.s3.amazonaws.com/jrc_hela-2/jrc_hela-2.n5";
final String dataset = "/em/fibsem-uint16/s4";
final N5Reader n5 = Singleton.get(
url,
() -> new N5Factory().openReader( url ) );
final RandomAccessibleInterval< T > img = Singleton.get(
url + ":" + dataset,
() -> N5Utils.open( n5, dataset ) );
Modifier and Type | Class and Description |
---|---|
static interface |
Singleton.ThrowingSupplier<T,E extends Exception> |
Modifier and Type | Method and Description |
---|---|
static void |
clear()
Clear all named singletons.
|
static <T,E extends Exception> |
get(String key,
Singleton.ThrowingSupplier<T,E> supplier)
Get or create the named singleton instance of T.
|
static Object |
remove(String key)
Remove and retrieve a named singleton instance.
|
public static Object remove(String key)
key
- public static <T,E extends Exception> T get(String key, Singleton.ThrowingSupplier<T,E> supplier) throws E extends Exception
T
- E
- key
- supplier
- E
E extends Exception
public static void clear()
Copyright © 2015–2022 ImgLib2. All rights reserved.