Top Description Fields Constructors Methods
org.osgi.service.dal.functions.data

public Class KeypadData

extends FunctionData
Class Inheritance
Imports
java.util.Map, org.osgi.service.dal.FunctionData, org.osgi.service.dal.functions.Keypad

Represents a keypad event data that is collected when a change with some key from the keypad has occurred.

The key pressed event is using TYPE_PRESSED type, while the key released event is using TYPE_RELEASED type.

See Also
Keypad, FunctionData

Field Summary

Modifier and TypeField and Description
public static final String
FIELD_KEY_CODE

Represents the key code field name.

public static final String
FIELD_KEY_NAME

Represents the key name field name.

public static final String
FIELD_SUB_TYPE

Represents the event sub-type field name.

public static final String
FIELD_TYPE

Represents the event type field name.

private final int
private final String
public static final int
SUB_TYPE_PRESSED_DOUBLE

Represents a keypad event sub-type for a double key pressed event.

public static final int
SUB_TYPE_PRESSED_DOUBLE_LONG

Represents a keypad event sub-type for a double long key pressed event.

public static final int
SUB_TYPE_PRESSED_LONG

Represents a keypad event sub-type for a long key pressed event.

public static final int
SUB_TYPE_PRESSED_NORMAL

Represents a keypad event sub-type for a normal key pressed event.

private final int
private final int
public static final int
TYPE_PRESSED

Represents a keypad event type for a key pressed event.

public static final int
TYPE_RELEASED

Represents a keypad event type for a key released event.

Inherited from org.osgi.service.dal.FunctionData:
DESCRIPTIONFIELD_METADATAFIELD_TIMESTAMP

Constructor Summary

AccessConstructor and Description
public
KeypadData(Map<String, ?>
Contains the new KeypadData instance field values.
fields
)

Constructs new KeypadData instance with the specified field values.

public
KeypadData(long
The data timestamp optional field.
timestamp
,
Map<String, Object>
The data metadata optional field.
metadata
,
int
The data event type mandatory field.
type
,
int
The data event sub-type optional field or 0 if there is no sub-type.
subType
,
int
The data key code mandatory field.
keyCode
,
String
The data key name optional field or null if there is no key name.
keyName
)

Constructs new KeypadData instance with the specified arguments.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

-1, 0 or 1 depending on the comparison rules.
compareTo
(Object
KeypadData to be compared.
o
)

Overrides org.osgi.service.dal.FunctionData.compareTo.

Implements java.lang.Comparable.compareTo.

Compares this KeypadData instance with the given argument.

public boolean

Returns:

true if this object is equivalent to the specified one.
equals
(Object
The object to compare this data.
o
)

Overrides org.osgi.service.dal.FunctionData.equals.

Two KeypadData instances are equal if they contain equal metadata, timestamp, event type, key code and key name.

public int

Returns:

The key code.
getKeyCode
()

The code of the key.

public String

Returns:

A string with the name of the key or null if not specified.
getKeyName
()

Represents a human readable name of the corresponding key code.

public int

Returns:

The event sub-type.
getSubType
()

Returns the event sub-type.

public int

Returns:

The event type.
getType
()

Returns the event type.

private String
public int

Returns:

The hash code of this LevelData object.
hashCode
()

Overrides org.osgi.service.dal.FunctionData.hashCode.

Returns the hash code for this KeypadData object.

public String

Returns:

The string representation of this keypad data.
toString
()

Overrides java.lang.Object.toString.

Returns the string representation of this keypad data.

private void
Inherited from org.osgi.service.dal.FunctionData:
getMetadatagetTimestamp

Field Detail

FIELD_KEY_CODEback to summary
public static final String FIELD_KEY_CODE

Represents the key code field name. The field value is available with getKeyCode(). The field type is int . The constant can be used as a key to KeypadData(Map).

FIELD_KEY_NAMEback to summary
public static final String FIELD_KEY_NAME

Represents the key name field name. The field value is available with getKeyName(). The field type is String. The constant can be used as a key to KeypadData(Map).

FIELD_SUB_TYPEback to summary
public static final String FIELD_SUB_TYPE

Represents the event sub-type field name. The field value is available with getSubType(). The field type is int. The constant can be used as a key to KeypadData(Map).

FIELD_TYPEback to summary
public static final String FIELD_TYPE

Represents the event type field name. The field value is available with getType(). The field type is int. The constant can be used as a key to KeypadData(Map).

keyCodeback to summary
private final int keyCode
keyNameback to summary
private final String keyName
SUB_TYPE_PRESSED_DOUBLEback to summary
public static final int SUB_TYPE_PRESSED_DOUBLE

Represents a keypad event sub-type for a double key pressed event. Usually, there are two press actions and the key is not held down after the second press. This sub-type is used with TYPE_PRESSED type.

SUB_TYPE_PRESSED_DOUBLE_LONGback to summary
public static final int SUB_TYPE_PRESSED_DOUBLE_LONG

Represents a keypad event sub-type for a double long key pressed event. Usually, there are two press actions and the key is held down after the second press. This sub-type is used with TYPE_PRESSED type.

SUB_TYPE_PRESSED_LONGback to summary
public static final int SUB_TYPE_PRESSED_LONG

Represents a keypad event sub-type for a long key pressed event. Usually, there is a single press and the key is held down. This sub-type is used with TYPE_PRESSED type.

SUB_TYPE_PRESSED_NORMALback to summary
public static final int SUB_TYPE_PRESSED_NORMAL

Represents a keypad event sub-type for a normal key pressed event. Usually, there is a single press and the key is not held down. This sub-type is used with TYPE_PRESSED type.

subTypeback to summary
private final int subType
typeback to summary
private final int type
TYPE_PRESSEDback to summary
public static final int TYPE_PRESSED

Represents a keypad event type for a key pressed event.

TYPE_RELEASEDback to summary
public static final int TYPE_RELEASED

Represents a keypad event type for a key released event.

Constructor Detail

KeypadDataback to summary
public KeypadData(Map<String, ?> fields)

Constructs new 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.

Parameters
fields:Map<String, ?>

Contains the new KeypadData instance field values.

Exceptions
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.
KeypadDataback to summary
public KeypadData(long timestamp, Map<String, Object> metadata, int type, int subType, int keyCode, String keyName)

Constructs new KeypadData instance with the specified arguments.

Parameters
timestamp:long

The data timestamp optional field.

metadata:Map<String, Object>

The data metadata optional field.

type:int

The data event type mandatory field.

subType:int

The data event sub-type optional field or 0 if there is no sub-type.

keyCode:int

The data key code mandatory field.

keyName:String

The data key name optional field or null if there is no key name.

Method Detail

compareToback to summary
public int compareTo(Object o)

Overrides org.osgi.service.dal.FunctionData.compareTo.

Implements java.lang.Comparable.compareTo.

Compares this 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.
The fields are compared in this order: timestamp, metadata, type, sub-type, key code, key name.
Parameters
o:Object

KeypadData to be compared.

Returns:int

-1, 0 or 1 depending on the comparison rules.

Annotations
@Override
Exceptions
ClassCastException:
If the method argument is not of type KeypadData.
See Also
java.lang.Comparable#compareTo(java.lang.Object)
equalsback to summary
public boolean equals(Object o)

Overrides org.osgi.service.dal.FunctionData.equals.

Two KeypadData instances are equal if they contain equal metadata, timestamp, event type, key code and key name.

Parameters
o:Object

The object to compare this data.

Returns:boolean

true if this object is equivalent to the specified one.

Annotations
@Override
See Also
org.osgi.service.dal.FunctionData#equals(java.lang.Object)
getKeyCodeback to summary
public int getKeyCode()

The code of the key. This field is mandatory and it holds the semantics(meaning) of the key.

Returns:int

The key code.

getKeyNameback to summary
public String getKeyName()

Represents a human readable name of the corresponding key code. This field is optional and sometimes it could be missed(might be null ).

Returns:String

A string with the name of the key or null if not specified.

getSubTypeback to summary
public int getSubType()

Returns the event sub-type. The sub-type provides additional details about the event. The sub-type can be one of:

Zero and positive values are reserved for this definition and further extensions of the sub-types. Custom sub-types can be used only as negative values to prevent potential collisions.
Returns:int

The event sub-type.

getTypeback to summary
public int getType()

Returns the event type. The type represents the main reason for this event. It can be one of:

Returns:int

The event type.

getTypeAsStringback to summary
private String getTypeAsString()
hashCodeback to summary
public int hashCode()

Overrides org.osgi.service.dal.FunctionData.hashCode.

Returns the hash code for this 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.

Returns:int

The hash code of this LevelData object.

Annotations
@Override
See Also
org.osgi.service.dal.FunctionData#hashCode()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the string representation of this keypad data.

Returns:String

The string representation of this keypad data.

Annotations
@Override
validateback to summary
private void validate()