|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.parameters.ParameterModel
com.arsdigita.bebop.parameters.BitSetParameter
Encode and decode a bit set as a request parameter. The bit set is
stored in a BitSet
and encoded and decoded from
the HTTP request appropriately.
Currently two forms of encoding are supported: RAW encoding and
DGap. RAW encoding stuffs the bits straight into characters. DGap is a
variation on run length encoding particularly suited to
bitsets. The most appropriate encoding to use depends on the
distribution of bits. Since it iss not always possible to
anticipate this distribution, an automatic encoding mode is
provided which chooses the encoding with the shortest resulting
string size.
Field Summary | |
static int |
ENCODE_AUTO
Flag to automatically choose the shortest encoding scheme |
static int |
ENCODE_DGAP
Flag for DGap encoding of bit set |
static int |
ENCODE_RAW
Flag for RAW encoding of bit set |
static String |
versionId
|
Fields inherited from class com.arsdigita.bebop.parameters.ParameterModel |
m_defaultValue, m_locked, m_name, m_parameterListeners |
Constructor Summary | |
BitSetParameter(String name)
Create a bit set parameter with the given name, defaulting to the RAW encoding scheme |
|
BitSetParameter(String name,
int encode)
Create a bit set parameter with the given name. |
Method Summary | |
Class |
getValueClass()
Return the class that all values produced by the model will have. |
String |
marshal(Object value)
Turn the value, which must be a BitSet , into a
string that can be read by unmarshal . |
Object |
transformValue(javax.servlet.http.HttpServletRequest request)
Extract a bit set from the HTTP request. |
Object |
unmarshal(String value)
Read a string in the format produced by marshal and
produce the corresponding BitSet . |
Methods inherited from class com.arsdigita.bebop.parameters.ParameterModel |
addParameterListener, createParameterData, createParameterData, createParameterData, getDefaultOverridesNull, getDefaultValue, getName, isLocked, isPassIn, lock, setDefaultOverridesNull, setDefaultValue, setName, setPassIn, transformSingleValue, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
public static final int ENCODE_RAW
public static final int ENCODE_DGAP
public static final int ENCODE_AUTO
Constructor Detail |
public BitSetParameter(String name, int encode)
name
- the name of this parameter for use in URLs etc.encode
- the encoding schemepublic BitSetParameter(String name)
name
- the name of this parameter for use in URLs etc.Method Detail |
public Object transformValue(javax.servlet.http.HttpServletRequest request) throws IllegalArgumentException
BitSet
.
transformValue
in class ParameterModel
request
- the HTTP request
BitSet
extracted from the request or
null
.
IllegalArgumentException
- if the parameter can not be
transformed into a bit set.public Object unmarshal(String value) throws IllegalArgumentException
marshal
and
produce the corresponding BitSet
.
unmarshal
in class ParameterModel
value
- A string representing the bit set.
BitSet
corresponding to the value.
IllegalArgumentException
- if the value can not be
transformed into a bit set.marshal(java.lang.Object)
public String marshal(Object value)
BitSet
, into a
string that can be read by unmarshal
.
marshal
in class ParameterModel
value
- a BitSet
produced by this parameter
model.
unmarshal(java.lang.String)
public Class getValueClass()
ParameterModel
Object.class
getValueClass
in class ParameterModel
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |