Package org.bremersee.exception
Class AbstractServiceExceptionBuilder<T extends ServiceException>
- java.lang.Object
-
- org.bremersee.exception.AbstractServiceExceptionBuilder<T>
-
- Type Parameters:
T
- the exception type
- All Implemented Interfaces:
Serializable
,ServiceExceptionBuilder<T>
public abstract class AbstractServiceExceptionBuilder<T extends ServiceException> extends Object implements ServiceExceptionBuilder<T>
The abstract service exception builder.- Author:
- Christian Bremer
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractServiceExceptionBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
build()
Build the service exception.protected abstract T
buildWith(int httpStatus, String errorCode)
Build the service exception with the given values.protected abstract T
buildWith(int httpStatus, String errorCode, String reason)
Build the service exception with the given values.protected abstract T
buildWith(int httpStatus, String errorCode, String reason, Throwable cause)
Build the service exception with the given values.protected abstract T
buildWith(int httpStatus, String errorCode, Throwable cause)
Build the service exception with the given values.ServiceExceptionBuilder<T>
cause(Throwable cause)
sets cause on service exception builder.ServiceExceptionBuilder<T>
errorCode(String errorCode)
Sets error code on service exception builder.ServiceExceptionBuilder<T>
httpStatus(int httpStatus)
Sets http status on service exception builder.ServiceExceptionBuilder<T>
reason(String reason)
Sets reason on service exception builder.
-
-
-
Method Detail
-
httpStatus
public ServiceExceptionBuilder<T> httpStatus(int httpStatus)
Description copied from interface:ServiceExceptionBuilder
Sets http status on service exception builder.- Specified by:
httpStatus
in interfaceServiceExceptionBuilder<T extends ServiceException>
- Parameters:
httpStatus
- the http status- Returns:
- the service exception builder
-
errorCode
public ServiceExceptionBuilder<T> errorCode(String errorCode)
Description copied from interface:ServiceExceptionBuilder
Sets error code on service exception builder.- Specified by:
errorCode
in interfaceServiceExceptionBuilder<T extends ServiceException>
- Parameters:
errorCode
- the error code- Returns:
- the service exception builder
-
reason
public ServiceExceptionBuilder<T> reason(String reason)
Description copied from interface:ServiceExceptionBuilder
Sets reason on service exception builder.- Specified by:
reason
in interfaceServiceExceptionBuilder<T extends ServiceException>
- Parameters:
reason
- the reason- Returns:
- the service exception builder
-
cause
public ServiceExceptionBuilder<T> cause(Throwable cause)
Description copied from interface:ServiceExceptionBuilder
sets cause on service exception builder.- Specified by:
cause
in interfaceServiceExceptionBuilder<T extends ServiceException>
- Parameters:
cause
- the cause- Returns:
- the service exception builder
-
build
public T build()
Description copied from interface:ServiceExceptionBuilder
Build the service exception.- Specified by:
build
in interfaceServiceExceptionBuilder<T extends ServiceException>
- Returns:
- the service exception
-
buildWith
protected abstract T buildWith(int httpStatus, String errorCode)
Build the service exception with the given values.- Parameters:
httpStatus
- the http statuserrorCode
- the error code- Returns:
- the service exception
-
buildWith
protected abstract T buildWith(int httpStatus, String errorCode, String reason)
Build the service exception with the given values.- Parameters:
httpStatus
- the http statuserrorCode
- the error codereason
- the reason- Returns:
- the service exception
-
buildWith
protected abstract T buildWith(int httpStatus, String errorCode, Throwable cause)
Build the service exception with the given values.- Parameters:
httpStatus
- the http statuserrorCode
- the error codecause
- the cause- Returns:
- the t
-
-