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.errorentry in a response map.- Since:
- 14 Jul 2008
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCODE_KEYKey for a numeric or textual code identifying the error.static java.lang.StringDEBUGTXT_KEYKey for debugging information such as a stack trace.static java.lang.StringERRORTXT_KEYKey for short description of what went wrong.static java.lang.StringUSERTXT_KEYKey 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_KEYvalue.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 ErrInfoasErrInfo(java.util.Map map)Returns a given map as an ErrInfo object.voidcheck()Checks that this object is ready for use with the SAMP toolkit.java.lang.StringgetCode()Returns the value for theCODE_KEYkey.java.lang.StringgetDebugtxt()Returns the value for theDEBUGTXT_KEYkey.java.lang.StringgetErrortxt()Returns the value for theERRORTXT_KEYkey.java.lang.StringgetUsertxt()Returns the value for theUSERTXT_KEYkey.voidsetCode(java.lang.String code)Sets the value for theCODE_KEYkey.voidsetDebugtxt(java.lang.String debugtxt)Sets the value for theDEBUGTXT_KEYkey.voidsetErrortxt(java.lang.String errortxt)Sets the value for theERRORTXT_KEYkey.voidsetUsertxt(java.lang.String usertxt)Sets the value for theUSERTXT_KEYkey.-
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_KEYvalue.- Parameters:
errortxt- short string describing what went wrong
-
-
Method Detail
-
setErrortxt
public void setErrortxt(java.lang.String errortxt)
Sets the value for theERRORTXT_KEYkey.- Parameters:
errortxt- short string describing what went wrong
-
getErrortxt
public java.lang.String getErrortxt()
Returns the value for theERRORTXT_KEYkey.- Returns:
- short string describing what went wrong
-
setUsertxt
public void setUsertxt(java.lang.String usertxt)
Sets the value for theUSERTXT_KEYkey.- Parameters:
usertxt- free-form string giving more detail on the error
-
getUsertxt
public java.lang.String getUsertxt()
Returns the value for theUSERTXT_KEYkey.- Returns:
- free-form string giving more detail on the error
-
setDebugtxt
public void setDebugtxt(java.lang.String debugtxt)
Sets the value for theDEBUGTXT_KEYkey.- Parameters:
debugtxt- string containing debugging information, such as a a stack trace
-
getDebugtxt
public java.lang.String getDebugtxt()
Returns the value for theDEBUGTXT_KEYkey.- Returns:
- string containing debugging information, such as a stack trace
-
setCode
public void setCode(java.lang.String code)
Sets the value for theCODE_KEYkey.- Parameters:
code- numeric or textual code identifying the error
-
getCode
public java.lang.String getCode()
Returns the value for theCODE_KEYkey.- Returns:
- numeric or textual code identifying the error
-
check
public void check()
Description copied from class:SampMapChecks 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 informativeDataExceptionwill be thrown.
-
asErrInfo
public static ErrInfo asErrInfo(java.util.Map map)
Returns a given map as an ErrInfo object.- Parameters:
map- map- Returns:
- errInfo
-
-