Class CCAbstractItem

java.lang.Object
com.ibm.debug.pdt.codecoverage.core.results.CCAbstractItem
All Implemented Interfaces:
ICCBase
Direct Known Subclasses:
CCAbstractExporter, CCAbstractExporterInfo, CCAbstractExporterSettings, CCAbstractImportInput, CCAbstractTreeItem

public abstract class CCAbstractItem extends Object implements ICCBase
Base implementation of ICCBase. Implementors of the API exporter and importer interfaces can use this default implementation or implement ICCBase directly
Since:
3.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    addEncodedMessage(String encodedMessage)
    Messages are stored in an encoded format This format consists of a message key and 0 or more parameters By storing the parameters separate from the message text the translated message can be combined at display time This method allows the already encoded message to be stored directly in the ICCBase object
    final void
    addMessage(String messageKey, String... parms)
    This is a helper method to store a message and its parms in a format that doesn't contain translatable text.
    final void
    Add message text from an exception to this artifact
    Returns an array of decoded messages ICCBase.getMessages() returns the encoded form, this method returns the messages already decoded The messages will be decoded using the default locale
    Returns an array of decoded messages using the supplied locale ICCBase.getMessages() returns the encoded form, this method returns the messages already decoded
    final int
    Get a unique ID associated with this artifact
    final String[]
    Return messages associated with this artifact Messages that were added as plain text will be returned as is Use CCMessageUtilities to decode the messages
    final String
    Returns a meaningful name for the item Items will have other methods if the name can have context information
    Returns the list of available properties
    Get a property associated with this artifact
    final Object
    getProperty(String key, Object defaultValue)
    Get a property and if it doesn't exist return the default value
    boolean
    Returns true if there are messages
    boolean
    Returns true if the property has been set
    void
    Set the name of this artifact In version 10.1 this became part of the API
    final void
    setProperty(String key, Object value)
    Set a property associated with this artifact.
    Updates a property only if a valid value is passed.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • addMessage

      public final void addMessage(String messageKey, String... parms)
      This is a helper method to store a message and its parms in a format that doesn't contain translatable text. Given a message key and an array of zero or more parms the message in converted to an internal format. This method can be used when adding a message to an #ICCBase object where the key and parms are stored. CCMessageUtilities.getMessage(String) can be used to retrieve the message and the text in the default language. New behavior in 7.0 supports enforcing a single instance of a message. Add messages using addSingletonMsg(String)
      Specified by:
      addMessage in interface ICCBase
      Parameters:
      messageKey - message id
      parms - zero or more substitution text for the message
      Since:
      4.0
      See Also:
    • addMessage

      public final void addMessage(Throwable cause)
      Add message text from an exception to this artifact
      Specified by:
      addMessage in interface ICCBase
      Parameters:
      cause - exception to add as a message
      Since:
      4.0
    • addEncodedMessage

      public final void addEncodedMessage(String encodedMessage)
      Description copied from interface: ICCBase
      Messages are stored in an encoded format This format consists of a message key and 0 or more parameters By storing the parameters separate from the message text the translated message can be combined at display time This method allows the already encoded message to be stored directly in the ICCBase object
      Specified by:
      addEncodedMessage in interface ICCBase
      Parameters:
      encodedMessage - encoded message to add to artifact
      Since:
      4.0
    • getMessages

      public final String[] getMessages()
      Description copied from interface: ICCBase
      Return messages associated with this artifact Messages that were added as plain text will be returned as is Use CCMessageUtilities to decode the messages
      Specified by:
      getMessages in interface ICCBase
      Returns:
      empty array or array of encoded messages
      See Also:
    • getDecodedMessages

      public String[] getDecodedMessages()
      Description copied from interface: ICCBase
      Returns an array of decoded messages ICCBase.getMessages() returns the encoded form, this method returns the messages already decoded The messages will be decoded using the default locale
      Specified by:
      getDecodedMessages in interface ICCBase
      Returns:
      empty array or array of decoded messages
      Since:
      5.0
    • getDecodedMessages

      public String[] getDecodedMessages(Locale locale)
      Description copied from interface: ICCBase
      Returns an array of decoded messages using the supplied locale ICCBase.getMessages() returns the encoded form, this method returns the messages already decoded
      Specified by:
      getDecodedMessages in interface ICCBase
      Parameters:
      locale - to use when decoding messages
      Returns:
      empty array or array of decoded messages
      Since:
      5.0
    • isMessage

      public boolean isMessage()
      Description copied from interface: ICCBase
      Returns true if there are messages
      Specified by:
      isMessage in interface ICCBase
      Returns:
      true if there are messages
    • setProperty

      public final void setProperty(String key, Object value)
      Description copied from interface: ICCBase
      Set a property associated with this artifact. It can be retrieved using ICCBase.getProperty(String) New in 9.0 the storing of null values for a property is no longer supported. If a null value is desired or has meaning then something like !NULL! should be used for the value. Properties unknown to the importer/exporter should be preserved. To help support this new behaviour the following changes have been made to how this method behaves
      1. Setting a property's value to null will remove it if it already exists
      2. Setting a property's value to null will do nothing if it does not already exist
      3. Setting a property to an empty string will remove it (same effect as passing in null)
      This will make it easier for exporters to preserve properties that were user supplied and avoid writing out empty properties. It will also all callers to write out properties without first checking if the value is null or an empty string.
      Specified by:
      setProperty in interface ICCBase
      Parameters:
      key - property key
      value - property value
    • updateProperty

      public Object updateProperty(String key, Object value)
      Description copied from interface: ICCBase
      Updates a property only if a valid value is passed. To be valid a value must be non-null and if a String is must not be empty. The property is updated and the updated value of the property is returned.
      Specified by:
      updateProperty in interface ICCBase
      Parameters:
      key - property name
      value - to update the property if not null or an empty String
      Returns:
      updated value of the property or the original if it was not updated
    • getProperty

      public Object getProperty(String key)
      Description copied from interface: ICCBase
      Get a property associated with this artifact
      Specified by:
      getProperty in interface ICCBase
      Parameters:
      key - or property name
      Returns:
      property value or null if the property does not exist
    • getProperty

      public final Object getProperty(String key, Object defaultValue)
      Description copied from interface: ICCBase
      Get a property and if it doesn't exist return the default value
      Specified by:
      getProperty in interface ICCBase
      Parameters:
      key - property key
      defaultValue - value to return if key not found
      Returns:
      property value or default value
    • isProperty

      public boolean isProperty(String key)
      Description copied from interface: ICCBase
      Returns true if the property has been set
      Specified by:
      isProperty in interface ICCBase
      Parameters:
      key - property key
      Returns:
      true if property set
    • getID

      public final int getID()
      Description copied from interface: ICCBase
      Get a unique ID associated with this artifact
      Specified by:
      getID in interface ICCBase
      Returns:
      unique ID
    • getName

      public final String getName()
      Description copied from interface: ICCBase
      Returns a meaningful name for the item Items will have other methods if the name can have context information
      Specified by:
      getName in interface ICCBase
      Returns:
      name assigned to item.
    • getProperties

      public String[] getProperties()
      Description copied from interface: ICCBase
      Returns the list of available properties
      Specified by:
      getProperties in interface ICCBase
      Returns:
      array of zero or more property keys
      Since:
      4.0
      See Also:
    • setName

      public void setName(String name)
      Set the name of this artifact In version 10.1 this became part of the API
      Specified by:
      setName in interface ICCBase
      Parameters:
      name - new name for this artifact
      Since:
      9.0