Package com.ibm.dbb.build.report.records
Class AnyTypeRecord
- java.lang.Object
-
- com.ibm.dbb.build.report.records.Record
-
- com.ibm.dbb.build.report.records.AnyTypeRecord
-
public class AnyTypeRecord extends Record
A simple record of any type that can be created and populated in a build script. It supports two types of attributes: String and List of Strings
-
-
Constructor Summary
Constructors Constructor Description AnyTypeRecord(java.lang.String type)
AnyTypeRecord(java.lang.String id, java.lang.String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAttribute(java.lang.String name)
Delete an attribute in the recordjava.lang.Object
getAttribute(java.lang.String name)
Return the Object value of an attribute stored in this recordjava.util.List<java.lang.String>
getAttributeAsList(java.lang.String name)
Return the value of a String List attribute stored in this record.java.lang.String
getAttributeAsString(java.lang.String name)
Return the value of a String attribute stored in this record.Record
parse(com.google.gson.JsonObject jsonObj)
Create the record from JSON.void
setAttribute(java.lang.String name, java.lang.String value)
Set a String value attribute to the record.void
setAttribute(java.lang.String name, java.util.List<java.lang.String> value)
Set a String List value to the record.com.google.gson.JsonObject
toJSON()
Returns the record in JSON format.
-
-
-
Method Detail
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.String value) throws BuildException
Set a String value attribute to the record. If the attribute already exists in the record, it will be replaced with the new value. NOTE: Attribute names "id" and "type" are reserved.- Parameters:
name
- name of the attributevalue
- String value of the attribute to add or replace- Throws:
BuildException
- if a reserved attribute name is used.
-
setAttribute
public void setAttribute(java.lang.String name, java.util.List<java.lang.String> value) throws BuildException
Set a String List value to the record. If the attribute already exists in the record, it will be replaced with the new value. NOTE: Attribute names "id" and "type" are reserved.- Parameters:
name
- name of the attributevalue
- String List value of the attribute to add or replace- Throws:
BuildException
- if a reserved attribute name is used.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Return the Object value of an attribute stored in this record- Parameters:
name
- the name of the attribute to be retrieved- Returns:
- the Object value of the attribute
-
getAttributeAsString
public java.lang.String getAttributeAsString(java.lang.String name) throws java.lang.ClassCastException
Return the value of a String attribute stored in this record. If the value is not of type String, then a ClassCastException is thrown.- Parameters:
name
- the name of the attribute to be retrieved- Returns:
- the String value of the attribute
- Throws:
java.lang.ClassCastException
- if the attribute value is not a String
-
getAttributeAsList
public java.util.List<java.lang.String> getAttributeAsList(java.lang.String name) throws java.lang.ClassCastException
Return the value of a String List attribute stored in this record. If the value is not of type String, then a ClassCastException is thrown.- Parameters:
name
- the name of the attribute to be retrieved- Returns:
- the String List value of the attribute
- Throws:
java.lang.ClassCastException
- if the attribute value is not a List
-
deleteAttribute
public void deleteAttribute(java.lang.String name)
Delete an attribute in the record- Parameters:
name
- the name of the attribute to delete
-
toJSON
public com.google.gson.JsonObject toJSON()
Returns the record in JSON format.
-
-