com.ibm.dbb.build.report.records

Class 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 and 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 and Description
      void deleteAttribute(java.lang.String name)
      Delete an attribute in the record
      java.lang.Object getAttribute(java.lang.String name)
      Return the Object value of an attribute stored in this record
      java.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.ibm.json.java.JSONObject jsonObj)
      Create the record from JSON.
      void setAttribute(java.lang.String name, java.util.List<java.lang.String> value)
      Set a String List value to the record.
      void setAttribute(java.lang.String name, java.lang.String value)
      Set a String value attribute to the record.
      com.ibm.json.java.JSONObject toJSON()
      Returns the record in JSON format.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AnyTypeRecord

        public AnyTypeRecord(java.lang.String type)
      • AnyTypeRecord

        public AnyTypeRecord(java.lang.String id,
                             java.lang.String type)
    • 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 attribute
        value - 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 attribute
        value - 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.ibm.json.java.JSONObject toJSON()
        Returns the record in JSON format.
        Overrides:
        toJSON in class Record
        Returns:
        the JSON format of this record.
      • parse

        public Record parse(com.ibm.json.java.JSONObject jsonObj)
        Create the record from JSON.
        Overrides:
        parse in class Record
        Parameters:
        jsonObj - The object in JSON to be parsed.
        Returns:
        the record representing by the supplied JSON contents.

<IBM Copyright © 2018 IBM Corp. All Rights Reserved.