Package step.functions.io
Class AbstractSession
- java.lang.Object
-
- step.functions.io.AbstractSession
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class AbstractSession extends Object implements Closeable
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Object>sessionObjects
-
Constructor Summary
Constructors Constructor Description AbstractSession()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()<T> Tget(Class<T> objectClass)Objectget(String arg0)<T,U>
TgetOrDefault(String key, Function<U,T> def, U param)Get a value from the sessionObject.<T> TgetOrDefault(String key, T def)Get a value from the sessionObject.voidput(Object object)Objectput(String arg0, Object arg1)
-
-
-
Method Detail
-
getOrDefault
public <T> T getOrDefault(String key, T def)
Get a value from the sessionObject. If the value does not exist set the given default value.- Type Parameters:
T- The type of the return value.- Parameters:
key- The key to search in the sessionObjects Map.def- The default value to use if the value does not exist.- Returns:
- The value from sessionObjects or the default value.
-
getOrDefault
public <T,U> T getOrDefault(String key, Function<U,T> def, U param)
Get a value from the sessionObject. If the value does not exist set the given default value.- Type Parameters:
T- The type of the return value.U- The type of the parameter for the default function.- Parameters:
key- The key to search in the sessionObjects Map.def- The function to apply for the default value.param- The parameter for the default function.- Returns:
- The value from sessionObjects or the default value.
-
get
public <T> T get(Class<T> objectClass)
-
put
public void put(Object object)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-