public class KeypadData extends FunctionData
The key pressed event is using TYPE_PRESSED
type, while the key
released event is using TYPE_RELEASED
type.
Keypad
,
FunctionData
Modifier and Type | Field and Description |
---|---|
static String |
FIELD_KEY_CODE
Represents the key code field name.
|
static String |
FIELD_KEY_NAME
Represents the key name field name.
|
static String |
FIELD_SUB_TYPE
Represents the event sub-type field name.
|
static String |
FIELD_TYPE
Represents the event type field name.
|
static int |
SUB_TYPE_PRESSED_DOUBLE
Represents a keypad event sub-type for a double key pressed event.
|
static int |
SUB_TYPE_PRESSED_DOUBLE_LONG
Represents a keypad event sub-type for a double long key pressed event.
|
static int |
SUB_TYPE_PRESSED_LONG
Represents a keypad event sub-type for a long key pressed event.
|
static int |
SUB_TYPE_PRESSED_NORMAL
Represents a keypad event sub-type for a normal key pressed event.
|
static int |
TYPE_PRESSED
Represents a keypad event type for a key pressed event.
|
static int |
TYPE_RELEASED
Represents a keypad event type for a key released event.
|
DESCRIPTION, FIELD_METADATA, FIELD_TIMESTAMP
Constructor and Description |
---|
KeypadData(long timestamp,
Map metadata,
int type,
int subType,
int keyCode,
String keyName)
Constructs new
KeypadData instance with the specified arguments. |
KeypadData(Map fields)
Constructs new
KeypadData instance with the specified field
values. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object o)
Compares this
KeypadData instance with the given argument. |
boolean |
equals(Object o)
Two
KeypadData instances are equal if they contain equal
metadata, timestamp, event type, key code and key name. |
int |
getKeyCode()
The code of the key.
|
String |
getKeyName()
Represents a human readable name of the corresponding key code.
|
int |
getSubType()
Returns the event sub-type.
|
int |
getType()
Returns the event type.
|
int |
hashCode()
Returns the hash code for this
KeypadData object. |
String |
toString()
Returns the string representation of this keypad data.
|
getMetadata, getTimestamp
public static final String FIELD_TYPE
getType()
. The field type is int
. The constant can be
used as a key to KeypadData(Map)
.public static final String FIELD_SUB_TYPE
getSubType()
. The field type is int
. The constant
can be used as a key to KeypadData(Map)
.public static final String FIELD_KEY_CODE
getKeyCode()
. The field type is int
. The constant can
be used as a key to KeypadData(Map)
.public static final String FIELD_KEY_NAME
getKeyName()
. The field type is String
. The constant can
be used as a key to KeypadData(Map)
.public static final int TYPE_PRESSED
public static final int TYPE_RELEASED
public static final int SUB_TYPE_PRESSED_NORMAL
TYPE_PRESSED
type.public static final int SUB_TYPE_PRESSED_LONG
TYPE_PRESSED
type.public static final int SUB_TYPE_PRESSED_DOUBLE
TYPE_PRESSED
type.public static final int SUB_TYPE_PRESSED_DOUBLE_LONG
TYPE_PRESSED
type.public KeypadData(Map fields)
KeypadData
instance with the specified field
values. The map keys must match to the field names. The map values will
be assigned to the appropriate class fields. For example, the maps can
be: {"type"=Integer(1)...}. That map will initialize the
FIELD_TYPE
field with 1.
FIELD_TYPE
- mandatory field. The value type must be
Integer
.FIELD_SUB_TYPE
- optional field. The value type must be
Integer
.FIELD_KEY_CODE
- mandatory field. The value type must be
Integer
.FIELD_KEY_NAME
- optional field. The value type must be
String
.fields
- Contains the new KeypadData
instance field values.ClassCastException
- If the field value types are not expected.IllegalArgumentException
- If the event type or key code is missing
or invalid arguments are specified.NullPointerException
- If the fields map is null
.public KeypadData(long timestamp, Map metadata, int type, int subType, int keyCode, String keyName)
KeypadData
instance with the specified arguments.timestamp
- The data timestamp optional field.metadata
- The data metadata optional field.type
- The data event type mandatory field.subType
- The data event sub-type optional field or 0
if
there is no sub-type.keyCode
- The data key code mandatory field.keyName
- The data key name optional field or null
if there
is no key name.public int getType()
public int getSubType()
public int getKeyCode()
public String getKeyName()
null
).null
if not
specified.public boolean equals(Object o)
KeypadData
instances are equal if they contain equal
metadata, timestamp, event type, key code and key name.equals
in class FunctionData
o
- The object to compare this data.true
if this object is equivalent to the specified one.FunctionData.equals(java.lang.Object)
public int hashCode()
KeypadData
object. The hash code
is a sum of FunctionData.hashCode()
, String.hashCode()
,
event type, event sub-type and key code, where String.hashCode()
represents the key name hash code if available.hashCode
in class FunctionData
LevelData
object.FunctionData.hashCode()
public int compareTo(Object o)
KeypadData
instance with the given argument. If the
argument is not KeypadData
, it throws ClassCastException
.
Otherwise, this method returns:
-1
if this instance field is less than a field of the
specified argument.0
if all fields are equivalent.1
if this instance field is greater than a field of the
specified argument.compareTo
in interface Comparable
compareTo
in class FunctionData
o
- KeypadData
to be compared.-1
, 0
or 1
depending on the comparison
rules.ClassCastException
- If the method argument is not of type
KeypadData
.Comparable.compareTo(java.lang.Object)
Copyright © OSGi Alliance (2000, 2015). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0