*
* Type helps identify type information of Value.
*
- * @see RCSResourceAttributes
+ * @see RcsResourceAttributes
* @see Type
*/
public final class RcsValue {
* @see Type
*/
public static enum TypeId {
- NULL, BOOLEAN, INTEGER, DOUBLE, STRING, ATTRIBUTES, ARRAY;
+ NULL, BOOLEAN, INTEGER, DOUBLE, STRING, BYTESTRING, ATTRIBUTES, ARRAY;
}
/**
* A Helper class to identify types of Value.
*
- * @see RCSResourceAttributes
- * @see Value
+ * @see RcsResourceAttributes
+ * @see RcsValue
* @see TypeId
*/
public static class Type {
*
* @return Identifier of type
*
- * @see getBaseTypeId
+ * @see #getBaseTypeId(RcsValue.Type)
*/
- public final TypeId getTypeId() {
+ public final TypeId getId() {
return mTypeId;
}
/**
* Returns the type identifier of a base type of sequence.
*
- * For non sequence types, it is equivalent to calling getId.
+ * For non sequence types, it is equivalent to calling {@link #getId()}.
*
* @return identifier of type
*
/**
* Factory method to create Type instance from an object.
+ * Note that object must be a supported type by RcsValue.
*
* @return An instance that has TypeId for obj.
*
- * @note object must be a supported type by Value.
- *
* @throws NullPointerException
* if obj is null.
* @throws IllegalArgumentException
}
/**
- * Factory method to create Type instance from a clss.
+ * Factory method to create Type instance from a class.
+ * Note that class must be a supported type by RcsValue.
*
* @return An instance that has TypeId for class.
*
- * @note class must be a supported type by Value.
- *
* @throws NullPointerException
* if cls is null.
* @throws IllegalArgumentException
types.put(Integer.class, new Type(TypeId.INTEGER));
types.put(Double.class, new Type(TypeId.DOUBLE));
types.put(String.class, new Type(TypeId.STRING));
+ types.put(RcsByteString.class, new Type(TypeId.BYTESTRING));
types.put(RcsResourceAttributes.class, new Type(TypeId.ATTRIBUTES));
types.put(boolean[].class, new ArrayType(TypeId.BOOLEAN, 1));
types.put(int[].class, new ArrayType(TypeId.INTEGER, 1));
types.put(double[].class, new ArrayType(TypeId.DOUBLE, 1));
types.put(String[].class, new ArrayType(TypeId.STRING, 1));
+ types.put(RcsByteString[].class, new ArrayType(TypeId.BYTESTRING, 1));
types.put(RcsResourceAttributes[].class,
new ArrayType(TypeId.ATTRIBUTES, 1));
types.put(int[][].class, new ArrayType(TypeId.INTEGER, 2));
types.put(double[][].class, new ArrayType(TypeId.DOUBLE, 2));
types.put(String[][].class, new ArrayType(TypeId.STRING, 2));
+ types.put(RcsByteString[][].class, new ArrayType(TypeId.BYTESTRING, 2));
types.put(RcsResourceAttributes[][].class,
new ArrayType(TypeId.ATTRIBUTES, 2));
types.put(int[][][].class, new ArrayType(TypeId.INTEGER, 3));
types.put(double[][][].class, new ArrayType(TypeId.DOUBLE, 3));
types.put(String[][][].class, new ArrayType(TypeId.STRING, 3));
+ types.put(RcsByteString[][][].class, new ArrayType(TypeId.BYTESTRING, 3));
types.put(RcsResourceAttributes[][][].class,
new ArrayType(TypeId.ATTRIBUTES, 3));
}
/**
- * Constructs a new value that holds null value.
+ * Constructs a new value that holds a boolean value.
*
* @param value
* a boolean
/**
* Constructs a new value that holds a RcsResourceAttributes array.
*
- * @param value
- * a RcsResourceAttributes array
+ * @param value a RcsByteString array
+ * @throws NullPointerException if value is null.
+ */
+ public RcsValue(RcsByteString[] value) {
+ this((Object) value);
+ }
+
+ /**
+ * Constructs a new value that holds a two-dimensional RcsByteString array.
+ *
+ * @param value a two-dimensional RcsByteString array
+ * @throws NullPointerException if value is null.
+ */
+ public RcsValue(RcsByteString[][] value) {
+ this((Object) value);
+ }
+
+ /**
+ * Constructs a new value that holds a three-dimensional RcsByteString array.
+ *
+ * @param value a three-dimensional RcsByteString array
+ * @throws NullPointerException if value is null.
+ */
+ public RcsValue(RcsByteString[][][] value) {
+ this((Object) value);
+ }
+
+ /**
+ * Constructs a new value that holds a RcsResourceAttributes array.
*
* @throws NullPointerException
* if value is null.
}
/**
- * Returns the value it represents is null.
+ * Returns whether the value is null.
*
* @return true if the value is null.
*/
}
/**
- * Returns the object represents null for RcsValue.
+ * Returns whether the object represents null for RcsValue.
*
* @param o
* an object to be tested
}
/**
+ * Returns the value as an RcsByteString array, null if the value is not the
+ * desired type.
+ *
+ * @return an RcsByteString array
+ */
+ public RcsByteString[] asByteStringArray() {
+ return getOrNull();
+ }
+
+ /**
+ * Returns the value as a two-dimensional RcsByteString array, null if the
+ * value is not the desired type.
+ *
+ * @return a two-dimensional RcsByteString array
+ */
+ public RcsByteString[][] asByteString2DArray() {
+ return getOrNull();
+ }
+
+ /**
+ * Returns the value as a three-dimensional RcsByteString array, null if the
+ * value is not the desired type.
+ *
+ * @return a three-dimensional RcsByteString array
+ */
+ public RcsByteString[][][] asByteString3DArray() {
+ return getOrNull();
+ }
+
+ /**
* Returns the value as an attributes array, null if the value is not the
* desired type.
*