Package com.android.ddmlib.log
Class EventContainer
- java.lang.Object
-
- com.android.ddmlib.log.EventContainer
-
public class EventContainer extends java.lang.Object
Represents an event and its data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EventContainer.CompareMethod
Comparison method fortestValue(int, Object, com.android.ddmlib.log.EventContainer.CompareMethod)
static class
EventContainer.EventValueType
Type for event data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Integer
getInt()
Returns the data as an int.java.lang.Long
getLong()
Returns the data as a long.java.lang.String
getString()
Returns the data as a String.EventContainer.EventValueType
getType()
Returns the type of the data.EventContainer.EventValueType
getType(java.lang.Object data)
Returns the type of an object.java.lang.Object
getValue(int valueIndex)
Returns a value by index.double
getValueAsDouble(int valueIndex)
Returns a value by index as a double.java.lang.String
getValueAsString(int valueIndex)
Returns a value by index as a String.boolean
testValue(int index, java.lang.Object value, EventContainer.CompareMethod compareMethod)
Checks that theindex
-th value of this event against a provided value.
-
-
-
Method Detail
-
getInt
public final java.lang.Integer getInt() throws InvalidTypeException
Returns the data as an int.- Throws:
InvalidTypeException
- if the data type is notEventContainer.EventValueType.INT
.- See Also:
getType()
-
getLong
public final java.lang.Long getLong() throws InvalidTypeException
Returns the data as a long.- Throws:
InvalidTypeException
- if the data type is notEventContainer.EventValueType.LONG
.- See Also:
getType()
-
getString
public final java.lang.String getString() throws InvalidTypeException
Returns the data as a String.- Throws:
InvalidTypeException
- if the data type is notEventContainer.EventValueType.STRING
.- See Also:
getType()
-
getValue
public java.lang.Object getValue(int valueIndex)
Returns a value by index. The return type is defined by its type.- Parameters:
valueIndex
- the index of the value. If the data is not a list, this is ignored.
-
getValueAsDouble
public double getValueAsDouble(int valueIndex) throws InvalidTypeException
Returns a value by index as a double.- Parameters:
valueIndex
- the index of the value. If the data is not a list, this is ignored.- Throws:
InvalidTypeException
- if the data type is notEventContainer.EventValueType.INT
,EventContainer.EventValueType.LONG
,EventContainer.EventValueType.LIST
, or if the item in the list at indexvalueIndex
is not of typeEventContainer.EventValueType.INT
orEventContainer.EventValueType.LONG
.- See Also:
getType()
-
getValueAsString
public java.lang.String getValueAsString(int valueIndex) throws InvalidTypeException
Returns a value by index as a String.- Parameters:
valueIndex
- the index of the value. If the data is not a list, this is ignored.- Throws:
InvalidTypeException
- if the data type is notEventContainer.EventValueType.INT
,EventContainer.EventValueType.LONG
,EventContainer.EventValueType.STRING
,EventContainer.EventValueType.LIST
, or if the item in the list at indexvalueIndex
is not of typeEventContainer.EventValueType.INT
,EventContainer.EventValueType.LONG
, orEventContainer.EventValueType.STRING
- See Also:
getType()
-
getType
public EventContainer.EventValueType getType()
Returns the type of the data.
-
getType
public final EventContainer.EventValueType getType(java.lang.Object data)
Returns the type of an object.
-
testValue
public boolean testValue(int index, java.lang.Object value, EventContainer.CompareMethod compareMethod) throws InvalidTypeException
Checks that theindex
-th value of this event against a provided value.- Parameters:
index
- the index of the value to testvalue
- the value to test againstcompareMethod
- the method of testing- Returns:
- true if the test passed.
- Throws:
InvalidTypeException
- in case of type mismatch between the value to test and the value to test against, or if the compare method is incompatible with the type of the values.- See Also:
EventContainer.CompareMethod
-
-