Class ErrInfo

  • All Implemented Interfaces:
    java.util.Map

    public class ErrInfo
    extends SampMap
    Represents the error information associated with a SAMP response. This corresponds to the samp.error entry in a response map.
    Since:
    14 Jul 2008
    Author:
    Mark Taylor
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CODE_KEY
      Key for a numeric or textual code identifying the error.
      static java.lang.String DEBUGTXT_KEY
      Key for debugging information such as a stack trace.
      static java.lang.String ERRORTXT_KEY
      Key for short description of what went wrong.
      static java.lang.String USERTXT_KEY
      Key for free-form text given more information about the error.
    • Constructor Summary

      Constructors 
      Constructor Description
      ErrInfo()
      Constructs an empty ErrInfo.
      ErrInfo​(java.lang.String errortxt)
      Constructs an ErrInfo with a given ERRORTXT_KEY value.
      ErrInfo​(java.lang.Throwable e)
      Constructs an ErrInfo based on a given Throwable.
      ErrInfo​(java.util.Map map)
      Constructs an ErrInfo based on an existing map.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ErrInfo asErrInfo​(java.util.Map map)
      Returns a given map as an ErrInfo object.
      void check()
      Checks that this object is ready for use with the SAMP toolkit.
      java.lang.String getCode()
      Returns the value for the CODE_KEY key.
      java.lang.String getDebugtxt()
      Returns the value for the DEBUGTXT_KEY key.
      java.lang.String getErrortxt()
      Returns the value for the ERRORTXT_KEY key.
      java.lang.String getUsertxt()
      Returns the value for the USERTXT_KEY key.
      void setCode​(java.lang.String code)
      Sets the value for the CODE_KEY key.
      void setDebugtxt​(java.lang.String debugtxt)
      Sets the value for the DEBUGTXT_KEY key.
      void setErrortxt​(java.lang.String errortxt)
      Sets the value for the ERRORTXT_KEY key.
      void setUsertxt​(java.lang.String usertxt)
      Sets the value for the USERTXT_KEY key.
      • Methods inherited from class java.util.AbstractMap

        clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • ERRORTXT_KEY

        public static final java.lang.String ERRORTXT_KEY
        Key for short description of what went wrong.
        See Also:
        Constant Field Values
      • USERTXT_KEY

        public static final java.lang.String USERTXT_KEY
        Key for free-form text given more information about the error.
        See Also:
        Constant Field Values
      • DEBUGTXT_KEY

        public static final java.lang.String DEBUGTXT_KEY
        Key for debugging information such as a stack trace.
        See Also:
        Constant Field Values
      • CODE_KEY

        public static final java.lang.String CODE_KEY
        Key for a numeric or textual code identifying the error.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ErrInfo

        public ErrInfo()
        Constructs an empty ErrInfo.
      • ErrInfo

        public ErrInfo​(java.lang.Throwable e)
        Constructs an ErrInfo based on a given Throwable.
        Parameters:
        e - error
      • ErrInfo

        public ErrInfo​(java.util.Map map)
        Constructs an ErrInfo based on an existing map.
        Parameters:
        map - map containing initial data for this object
      • ErrInfo

        public ErrInfo​(java.lang.String errortxt)
        Constructs an ErrInfo with a given ERRORTXT_KEY value.
        Parameters:
        errortxt - short string describing what went wrong
    • Method Detail

      • setErrortxt

        public void setErrortxt​(java.lang.String errortxt)
        Sets the value for the ERRORTXT_KEY key.
        Parameters:
        errortxt - short string describing what went wrong
      • getErrortxt

        public java.lang.String getErrortxt()
        Returns the value for the ERRORTXT_KEY key.
        Returns:
        short string describing what went wrong
      • setUsertxt

        public void setUsertxt​(java.lang.String usertxt)
        Sets the value for the USERTXT_KEY key.
        Parameters:
        usertxt - free-form string giving more detail on the error
      • getUsertxt

        public java.lang.String getUsertxt()
        Returns the value for the USERTXT_KEY key.
        Returns:
        free-form string giving more detail on the error
      • setDebugtxt

        public void setDebugtxt​(java.lang.String debugtxt)
        Sets the value for the DEBUGTXT_KEY key.
        Parameters:
        debugtxt - string containing debugging information, such as a a stack trace
      • getDebugtxt

        public java.lang.String getDebugtxt()
        Returns the value for the DEBUGTXT_KEY key.
        Returns:
        string containing debugging information, such as a stack trace
      • setCode

        public void setCode​(java.lang.String code)
        Sets the value for the CODE_KEY key.
        Parameters:
        code - numeric or textual code identifying the error
      • getCode

        public java.lang.String getCode()
        Returns the value for the CODE_KEY key.
        Returns:
        numeric or textual code identifying the error
      • check

        public void check()
        Description copied from class: SampMap
        Checks that this object is ready for use with the SAMP toolkit. As well as calling SampUtils.checkMap(java.util.Map) (ensuring that all keys are Strings, and all values Strings, Lists or Maps), subclass-specific invariants may be checked. In the case that there's something wrong, an informative DataException will be thrown.
        Overrides:
        check in class SampMap
      • asErrInfo

        public static ErrInfo asErrInfo​(java.util.Map map)
        Returns a given map as an ErrInfo object.
        Parameters:
        map - map
        Returns:
        errInfo