Package org.astrogrid.samp
Class ErrInfo
- java.lang.Object
-
- java.util.AbstractMap
-
- org.astrogrid.samp.SampMap
-
- org.astrogrid.samp.ErrInfo
-
- All Implemented Interfaces:
java.util.Map
public class ErrInfo extends SampMap
Represents the error information associated with a SAMP response. This corresponds to thesamp.error
entry in a response map.- Since:
- 14 Jul 2008
- Author:
- Mark Taylor
-
-
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 givenERRORTXT_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 theCODE_KEY
key.java.lang.String
getDebugtxt()
Returns the value for theDEBUGTXT_KEY
key.java.lang.String
getErrortxt()
Returns the value for theERRORTXT_KEY
key.java.lang.String
getUsertxt()
Returns the value for theUSERTXT_KEY
key.void
setCode(java.lang.String code)
Sets the value for theCODE_KEY
key.void
setDebugtxt(java.lang.String debugtxt)
Sets the value for theDEBUGTXT_KEY
key.void
setErrortxt(java.lang.String errortxt)
Sets the value for theERRORTXT_KEY
key.void
setUsertxt(java.lang.String usertxt)
Sets the value for theUSERTXT_KEY
key.-
Methods inherited from class org.astrogrid.samp.SampMap
checkHasKeys, entrySet, getList, getMap, getString, getUrl, put
-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
-
-
-
-
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 givenERRORTXT_KEY
value.- Parameters:
errortxt
- short string describing what went wrong
-
-
Method Detail
-
setErrortxt
public void setErrortxt(java.lang.String errortxt)
Sets the value for theERRORTXT_KEY
key.- Parameters:
errortxt
- short string describing what went wrong
-
getErrortxt
public java.lang.String getErrortxt()
Returns the value for theERRORTXT_KEY
key.- Returns:
- short string describing what went wrong
-
setUsertxt
public void setUsertxt(java.lang.String usertxt)
Sets the value for theUSERTXT_KEY
key.- Parameters:
usertxt
- free-form string giving more detail on the error
-
getUsertxt
public java.lang.String getUsertxt()
Returns the value for theUSERTXT_KEY
key.- Returns:
- free-form string giving more detail on the error
-
setDebugtxt
public void setDebugtxt(java.lang.String debugtxt)
Sets the value for theDEBUGTXT_KEY
key.- Parameters:
debugtxt
- string containing debugging information, such as a a stack trace
-
getDebugtxt
public java.lang.String getDebugtxt()
Returns the value for theDEBUGTXT_KEY
key.- Returns:
- string containing debugging information, such as a stack trace
-
setCode
public void setCode(java.lang.String code)
Sets the value for theCODE_KEY
key.- Parameters:
code
- numeric or textual code identifying the error
-
getCode
public java.lang.String getCode()
Returns the value for theCODE_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 callingSampUtils.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 informativeDataException
will be thrown.
-
asErrInfo
public static ErrInfo asErrInfo(java.util.Map map)
Returns a given map as an ErrInfo object.- Parameters:
map
- map- Returns:
- errInfo
-
-