Package org.apache.tapestry5.internal
Class EmptyEventContext
- java.lang.Object
-
- org.apache.tapestry5.internal.EmptyEventContext
-
- All Implemented Interfaces:
EventContext
public class EmptyEventContext extends java.lang.Object implements EventContext
Placeholder used when no context is available.
-
-
Constructor Summary
Constructors Constructor Description EmptyEventContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tget(java.lang.Class<T> desiredType, int index)This should never be called because the count is always zero.intgetCount()Always returns zero.booleanisEmpty()Returnstrueif this context contains no elements.java.lang.String[]toStrings()Extracts the value of each context value as a string.<T> java.util.Optional<T>tryGet(java.lang.Class<T> desiredType, int index)Tries to extract a parameter value and coerces or decodes it to the desired type.
-
-
-
Constructor Detail
-
EmptyEventContext
public EmptyEventContext()
-
-
Method Detail
-
getCount
public int getCount()
Always returns zero.- Specified by:
getCountin interfaceEventContext
-
get
public <T> T get(java.lang.Class<T> desiredType, int index)
This should never be called because the count is always zero.- Specified by:
getin interfaceEventContext- Parameters:
desiredType- the type of value requiredindex- identifies which parameter value to extract- Returns:
- the value extracted and converted or coerced
-
toStrings
public java.lang.String[] toStrings()
Description copied from interface:EventContextExtracts the value of each context value as a string.- Specified by:
toStringsin interfaceEventContext- Returns:
- context values
-
isEmpty
public boolean isEmpty()
Description copied from interface:EventContextReturnstrueif this context contains no elements.- Specified by:
isEmptyin interfaceEventContext
-
tryGet
public <T> java.util.Optional<T> tryGet(java.lang.Class<T> desiredType, int index)
Description copied from interface:EventContextTries to extract a parameter value and coerces or decodes it to the desired type.- Specified by:
tryGetin interfaceEventContext- Parameters:
desiredType- the type of value requiredindex- identifies which parameter value to extract- Returns:
- the value extracted and converted or coerced, wrapped in an Optional, or
Optional.empty()if index is out of bounds, or the value can't be converted.
-
-