Class Property<V>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<Byte>
com.highmobility.value.Bytes
com.highmobility.autoapi.property.Property<V>
- Type Parameters:
V- The value type. Eg Integer, CheckControlMessage, Duration
- Direct Known Subclasses:
PropertyInteger
public class Property<V>
extends com.highmobility.value.Bytes
Property is a representation of some AutoAPI data. It consists of 4 optional components: data, unit
timestamp, failure
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.highmobility.autoapi.property.PropertyComponentAvailabilityprotected List<PropertyComponent>protected PropertyComponentFailureprotected PropertyComponentTimestampprotected static final byte[]protected PropertyComponentValue<V>Fields inherited from class com.highmobility.value.Bytes
bytesFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionProperty(byte[] bytes) Property(byte identifier, V value, Calendar timestamp, PropertyComponentFailure failure, com.highmobility.autoapi.property.PropertyComponentAvailability availability) -
Method Summary
Modifier and TypeMethodDescriptionaddValueComponent(com.highmobility.value.Bytes valueComponentValue) static byteboolToByte(boolean value) static byte[]calendarToBytes(Calendar calendar) protected voidcreateBytesFromComponents(byte propertyIdentifier) static byte[]doubleToBytes(double value) protected voidstatic byte[]floatToBytes(float value) static intfloatToIntPercentage(float value) static bytefloatToIntPercentageByte(float value) static BooleangetBool(byte value) static bytegetByte(boolean value) static CalendargetCalendar(byte[] bytes) static CalendargetCalendar(byte[] bytes, int at) static CalendargetCalendar(byte[] bytes, int at, int length) static CalendargetCalendar(Property property) static CalendargetCalendar(com.highmobility.value.Bytes bytes) getComponent(byte identifier) static DategetDate(byte[] bytes) static doublegetDouble(byte[] bytes) static doublegetDouble(byte[] bytes, int at) static doublegetDouble(com.highmobility.value.Bytes bytes) static doublegetDouble(com.highmobility.value.Bytes bytes, int at) static floatgetFloat(byte[] bytes) static floatgetFloat(byte[] bytes, int at) static floatgetFloat(com.highmobility.value.Bytes bytes) static floatgetFloat(com.highmobility.value.Bytes bytes, int at) static int[]getIntegerArray(com.highmobility.value.Bytes valueBytes) static longgetLong(byte[] b) static longgetLong(byte[] b, int at) static longgetLong(byte[] b, int at, int length) static floatgetPercentage(byte value) byteintstatic intgetSignedInt(byte value) static intgetSignedInt(byte[] bytes) static intgetSignedInt(byte[] bytes, int at, int length) static intgetSignedInt(com.highmobility.value.Bytes bytes) static StringgetString(byte[] bytes) static StringgetString(byte[] bytes, int at, int length) static StringgetString(com.highmobility.value.Bytes bytes) static StringgetString(com.highmobility.value.Bytes bytes, int at, int length) static intgetUnsignedInt(byte value) static intgetUnsignedInt(byte[] bytes) static intgetUnsignedInt(byte[] bytes, int at, int length) static intgetUnsignedInt(com.highmobility.value.Bytes bytes) static intgetUnsignedInt(com.highmobility.value.Bytes bytes, int at, int length) static intgetUtf8Length(CharSequence sequence) getValue()static com.highmobility.value.BytesintegerArrayToBytes(int[] value) static byte[]intToBytes(int value, int length) This works for both negative and positive ints.booleanstatic byte[]longToBytes(long l) voidprintFailedToParse(Exception e, com.highmobility.value.Bytes component) setIdentifier(byte identifier) Set a new identifier for the propertysetIdentifier(int identifier) static byte[]stringToBytes(String string) Methods inherited from class com.highmobility.value.Bytes
concat, concat, equals, get, getBase64, getBase64UrlSafe, getByteArray, getHex, getLength, getRange, set, set, set, size, toStringMethods inherited from class java.util.AbstractList
add, add, addAll, clear, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListMethods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Field Details
-
unknownBytes
protected static final byte[] unknownBytes -
value
-
timestamp
-
failure
-
availability
@Nullable protected com.highmobility.autoapi.property.PropertyComponentAvailability availability -
components
-
-
Constructor Details
-
Property
public Property(byte[] bytes) -
Property
-
Property
public Property(byte identifier, @Nullable V value, @Nullable Calendar timestamp, @Nullable PropertyComponentFailure failure, @Nullable com.highmobility.autoapi.property.PropertyComponentAvailability availability) -
Property
-
Property
-
Property
-
Property
-
Property
- Throws:
CommandParseException
-
-
Method Details
-
getPropertyIdentifier
public byte getPropertyIdentifier() -
getValue
- Returns:
- The property value.
-
getComponents
- Returns:
- All of the components.
-
getComponent
- Parameters:
identifier- The component identifier.- Returns:
- The component with the given identifier.
-
getValueComponent
- Returns:
- The value component.
-
getTimestamp
- Returns:
- The timestamp of the property.
-
getAvailability
- Returns:
- The availability of the property.
-
getFailureComponent
- Returns:
- The failure of the property.
-
getPropertyLength
public int getPropertyLength()- Returns:
- The length of the property components(not including the header).
-
findComponents
protected void findComponents() -
update
- Throws:
CommandParseException
-
update
-
addValueComponent
-
createBytesFromComponents
protected void createBytesFromComponents(byte propertyIdentifier) -
setIdentifier
Set a new identifier for the property- Parameters:
identifier- The identifier.- Returns:
- Self.
-
setIdentifier
-
isUniversalProperty
public boolean isUniversalProperty() -
printFailedToParse
-
getLong
- Throws:
IllegalArgumentException
-
getLong
- Throws:
IllegalArgumentException
-
getLong
- Throws:
IllegalArgumentException
-
longToBytes
public static byte[] longToBytes(long l) -
getFloat
- Throws:
IllegalArgumentException
-
getFloat
- Throws:
IllegalArgumentException
-
getFloat
- Throws:
IllegalArgumentException
-
getFloat
public static float getFloat(com.highmobility.value.Bytes bytes, int at) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
floatToBytes
public static byte[] floatToBytes(float value) -
getDouble
- Throws:
IllegalArgumentException
-
getDouble
- Throws:
IllegalArgumentException
-
getDouble
- Throws:
IllegalArgumentException
-
getDouble
public static double getDouble(com.highmobility.value.Bytes bytes, int at) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
doubleToBytes
public static byte[] doubleToBytes(double value) -
floatToIntPercentage
public static int floatToIntPercentage(float value) -
floatToIntPercentageByte
public static byte floatToIntPercentageByte(float value) -
getPercentage
public static float getPercentage(byte value) -
getUnsignedInt
public static int getUnsignedInt(byte value) -
getUnsignedInt
public static int getUnsignedInt(com.highmobility.value.Bytes bytes) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getUnsignedInt
- Throws:
IllegalArgumentException
-
getUnsignedInt
public static int getUnsignedInt(com.highmobility.value.Bytes bytes, int at, int length) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getUnsignedInt
- Throws:
IllegalArgumentException
-
getSignedInt
public static int getSignedInt(byte value) -
getSignedInt
public static int getSignedInt(com.highmobility.value.Bytes bytes) -
getSignedInt
public static int getSignedInt(byte[] bytes) -
getSignedInt
public static int getSignedInt(byte[] bytes, int at, int length) -
intToBytes
This works for both negative and positive ints.- Parameters:
value- the valueBytes converted to byte[]length- the returned byte[] length- Returns:
- the allBytes representing the valueBytes
- Throws:
IllegalArgumentException- when input is invalid
-
getBool
-
boolToByte
public static byte boolToByte(boolean value) -
getByte
public static byte getByte(boolean value) -
getString
-
getString
-
getString
-
getString
-
stringToBytes
-
getUtf8Length
-
getDate
- Throws:
IllegalArgumentException
-
getCalendar
- Throws:
IllegalArgumentException
-
getCalendar
public static Calendar getCalendar(com.highmobility.value.Bytes bytes) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
getCalendar
- Throws:
IllegalArgumentException
-
getCalendar
- Throws:
IllegalArgumentException
-
getCalendar
public static Calendar getCalendar(byte[] bytes, int at, int length) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
calendarToBytes
-
getIntegerArray
public static int[] getIntegerArray(com.highmobility.value.Bytes valueBytes) -
integerArrayToBytes
public static com.highmobility.value.Bytes integerArrayToBytes(int[] value)
-