Class SException
- java.lang.Object
- 
- java.lang.Throwable
- 
- java.lang.Exception
- 
- java.lang.RuntimeException
- 
- simpleorm.utils.SException
 
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 - Direct Known Subclasses:
- SException.Data,- SException.Error,- SException.InternalError,- SException.Jdbc,- SException.Test,- SException.Validation,- SRecordInstance.BrokenOptimisticLockException
 
 public abstract class SException extends java.lang.RuntimeExceptionSimpleORM takes care to trap most error conditions and throw meaningful exception messages. Unlike most other Java code, they always include information about which objects were being processed at the time, eg. the primary key of the current record. We strongly encourage this practice as it greatly facilitates maintenance and debugging.Subclasses are actually thrown, namely SException.Errorto indicate probable bugs in the user's program,SException.InternalErrorto indicate bugs in SimpleOrm,SException.Jdbcfor chained JDBC errors,SException.Datafor errors that probably the result of run-time data problems.SException.Testis used to indicate failed test cases.Other well defined exceptions that a user may want to trap are given explicit subclasses (eg. SRecordInstance.BrokenOptimisticLockException).SimpleORM only throws SExceptions which extend RuntimeException and so avoid the need to clutter the code with unnecessary try/catch blocks. The only reason to use try/catch when using SimpleORM is because you really want to catch an error. (The author stongly disagrees with the way that Java forces one to declare and catch exceptions because it encourages mediocre programmers to hide exceptions which is a very nasty practice. (Even Sun programmers do this quite regularly in the Java libraries, eg. System.out.println()!) It also clutters the code for no good reason. IMHO Java's "checked" exceptions add no value whatsoever in practice.)- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classSException.DataErrors in data or environment at runtime, not necessarily a programming bug.static classSException.ErrorProbable bug in user's program.static classSException.InternalErrorProbable bug in SimpleORM.static classSException.JdbcChained JDBC Exception, could be anything as JDBC does not separate exceptions out and provides minimal information about their underlying causes.static classSException.TestException thrown due to failed unit test cases.static classSException.ValidationThis Exception thrown by user written code to indicate user data entry errors, especially in the business rule methods.
 - 
Constructor SummaryConstructors Constructor Description SException()Avoid using this one, include message.SException(java.lang.String message)SException(java.lang.String message, java.lang.Throwable nestedException)SException(java.lang.Throwable nestedException)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description SFieldMetagetFieldMeta()java.lang.ObjectgetFieldValue()SRecordInstancegetInstance()java.lang.Object[]getParams()SRecordInstancegetRecordInstance()java.lang.Class<SValidatorI>getValidator()SExceptionsetFieldMeta(SFieldMeta fieldMeta)SExceptionsetFieldValue(java.lang.Object fieldValue)SExceptionsetInstance(SRecordInstance instance)SExceptionsetParams(java.lang.Object... params)SExceptionsetRecordInstance(SRecordInstance instance)SExceptionsetValidator(java.lang.Class<SValidatorI> validator)
 
- 
- 
- 
Constructor Detail- 
SExceptionpublic SException(java.lang.String message, java.lang.Throwable nestedException)
 - 
SExceptionpublic SException(java.lang.String message) 
 - 
SExceptionpublic SException(java.lang.Throwable nestedException) 
 - 
SExceptionpublic SException() Avoid using this one, include message.
 
- 
 - 
Method Detail- 
getRecordInstancepublic SRecordInstance getRecordInstance() 
 - 
setRecordInstancepublic SException setRecordInstance(SRecordInstance instance) 
 - 
getFieldMetapublic SFieldMeta getFieldMeta() 
 - 
setFieldMetapublic SException setFieldMeta(SFieldMeta fieldMeta) 
 - 
getInstancepublic SRecordInstance getInstance() 
 - 
setInstancepublic SException setInstance(SRecordInstance instance) 
 - 
getFieldValuepublic java.lang.Object getFieldValue() 
 - 
setFieldValuepublic SException setFieldValue(java.lang.Object fieldValue) 
 - 
getParamspublic java.lang.Object[] getParams() 
 - 
setParamspublic SException setParams(java.lang.Object... params) 
 - 
getValidatorpublic java.lang.Class<SValidatorI> getValidator() 
 - 
setValidatorpublic SException setValidator(java.lang.Class<SValidatorI> validator) 
 
- 
 
-