|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.avis.client.ConnectionOptions
public final class ConnectionOptions
Connection options sent by the client to the server.
In addition to the options sent by the client to the router detailed below, the router may also add a "Vendor-Identification" option to its reply with a string identifying the router implementation, e.g. "Avis 1.2" or "elvind 4.4.0".
See http://elvin.org/specs for details on client connection options.
Field Summary | |
---|---|
static ConnectionOptions |
EMPTY_OPTIONS
An immutable set of empty options. |
Constructor Summary | |
---|---|
ConnectionOptions()
Create an empty instance. |
Method Summary | |
---|---|
Map<String,Object> |
asMap()
Generate an immutable, live map of the current options. |
Object |
get(String name)
Get the value for a connection option, or null if not defined. |
boolean |
getBoolean(String name)
Get a boolean value. |
boolean |
getBoolean(String name,
boolean defaultValue)
Get a boolean value. |
int |
getInt(String name)
Get an integer value. |
int |
getInt(String name,
int defaultValue)
Get an integer value. |
String |
getString(String name)
Get a string value. |
String |
getString(String name,
String defaultValue)
Get a string value. |
void |
includeLegacy(boolean newValue)
Enable legacy connection option compatibility (default is enabled). |
void |
set(String name,
boolean value)
Set a boolean value. |
void |
set(String name,
int value)
Set an integer value. |
void |
set(String name,
Object value)
Set a connection option. |
void |
set(String name,
String value)
Set a string value. |
void |
setAll(Map<String,Object> options)
Set a number of options at once. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ConnectionOptions EMPTY_OPTIONS
Constructor Detail |
---|
public ConnectionOptions()
Method Detail |
---|
public void includeLegacy(boolean newValue)
asMapWithLegacy()
public Map<String,Object> asMap()
asMapWithLegacy()
public void set(String name, Object value) throws IllegalArgumentException
name
- The option name.value
- The value. Must be a string or a number. Use null to clear.
IllegalArgumentException
- if value is not a string or an integer.public void set(String name, int value)
public void set(String name, boolean value)
getBoolean(String)
public void set(String name, String value)
public void setAll(Map<String,Object> options)
public Object get(String name)
public int getInt(String name) throws IllegalArgumentException
name
- The option name.
IllegalArgumentException
- if the option has no value or is
not an int.public int getInt(String name, int defaultValue) throws IllegalArgumentException
name
- The option name.defaultValue
- The default value. This is returned if there
is no value for the option.
IllegalArgumentException
- if the option is not an int.public String getString(String name) throws IllegalArgumentException
name
- The option name.
IllegalArgumentException
- if the option has no value or is
not a string.public String getString(String name, String defaultValue) throws IllegalArgumentException
name
- The option name.defaultValue
- The default value. This is returned if there
is no value for the option.
IllegalArgumentException
- if the option is not a string.public boolean getBoolean(String name) throws IllegalArgumentException
name
- The option name.
IllegalArgumentException
- if the option is not an int in
the range 0-1.public boolean getBoolean(String name, boolean defaultValue) throws IllegalArgumentException
name
- The option name.defaultValue
- The value to return if there is no value set.
IllegalArgumentException
- if the option is not an int in
the range 0-1.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |