Class DefaultPathVariables
- java.lang.Object
-
- com.github.fmjsjx.libnetty.http.server.DefaultPathVariables
-
- All Implemented Interfaces:
PathVariables
public class DefaultPathVariables extends java.lang.Object implements PathVariables
The default implementation ofPathVariables.- Since:
- 1.1
-
-
Field Summary
-
Fields inherited from interface com.github.fmjsjx.libnetty.http.server.PathVariables
EMPTY
-
-
Constructor Summary
Constructors Constructor Description DefaultPathVariables()Constructs a newDefaultPathVariables.DefaultPathVariables(java.util.Map<java.lang.String,java.lang.String> map)Constructs a newDefaultPathVariableswith the given map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists(java.lang.String name)Returns if the path variable by the name given exists.java.util.OptionalDoublegetDouble(java.lang.String name)Returns the path variable asdoubletype by the name given.java.util.OptionalIntgetInt(java.lang.String name)Returns the path variable asinttype by the name given.java.util.OptionalLonggetLong(java.lang.String name)Returns the path variable aslongtype by the name given.java.util.Optional<java.lang.String>getString(java.lang.String name)Returns the path variable by the name given.java.util.Collection<java.lang.String>names()Returns a collection contains of the names of all path variables.voidput(java.lang.String name, java.lang.String value)Puts a path variable by the specified name and value.intsize()Returns the size of the path variables.
-
-
-
Constructor Detail
-
DefaultPathVariables
public DefaultPathVariables()
Constructs a newDefaultPathVariables.
-
DefaultPathVariables
public DefaultPathVariables(java.util.Map<java.lang.String,java.lang.String> map)
Constructs a newDefaultPathVariableswith the given map.- Parameters:
map- a key-value map constants the path variables
-
-
Method Detail
-
put
public void put(java.lang.String name, java.lang.String value)Puts a path variable by the specified name and value.- Parameters:
name- the name of the path variablevalue- the value string of the path variable
-
getString
public java.util.Optional<java.lang.String> getString(java.lang.String name)
Description copied from interface:PathVariablesReturns the path variable by the name given.- Specified by:
getStringin interfacePathVariables- Parameters:
name- the name of the path variable- Returns:
Optional<String>
-
getInt
public java.util.OptionalInt getInt(java.lang.String name)
Description copied from interface:PathVariablesReturns the path variable asinttype by the name given.- Specified by:
getIntin interfacePathVariables- Parameters:
name- the name of the path variable- Returns:
OptionalInt
-
getLong
public java.util.OptionalLong getLong(java.lang.String name)
Description copied from interface:PathVariablesReturns the path variable aslongtype by the name given.- Specified by:
getLongin interfacePathVariables- Parameters:
name- the name of the path variable- Returns:
OptionalLong
-
getDouble
public java.util.OptionalDouble getDouble(java.lang.String name)
Description copied from interface:PathVariablesReturns the path variable asdoubletype by the name given.- Specified by:
getDoublein interfacePathVariables- Parameters:
name- the name of the path variable- Returns:
OptionalDouble
-
exists
public boolean exists(java.lang.String name)
Description copied from interface:PathVariablesReturns if the path variable by the name given exists.- Specified by:
existsin interfacePathVariables- Parameters:
name- the name of the path variable- Returns:
trueif the path variable by the name given exists,falseotherwise
-
size
public int size()
Description copied from interface:PathVariablesReturns the size of the path variables.- Specified by:
sizein interfacePathVariables- Returns:
- the size of the path variables
-
names
public java.util.Collection<java.lang.String> names()
Description copied from interface:PathVariablesReturns a collection contains of the names of all path variables.- Specified by:
namesin interfacePathVariables- Returns:
- a collection contains of the names of all path variables
-
-