Package io.sundr.model
Class Throw
java.lang.Object
io.sundr.model.Throw
- All Implemented Interfaces:
Node,Renderable,Statement,WithReferences
-
Field Summary
Fields inherited from interface io.sundr.model.Node
AT, CB, CC, CLP, COLN, COMA, CP, DOT, DQ, EMPTY, EQ, EXTENDS, GT, IMPLEMENTS, INDENT, JAVA_LANG, JAVA_LANG_ENUM, JAVA_LANG_OBJECT, JAVA_LANG_STRING, LT, NEWLINE, NEWLINE_PATTERN, OB, OC, OP, Q, SEMICOLN, SEMICOLN_SUFFIX_PATTERN, SPACE, STAR, THROWS, VARARG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ThrowillegalArgument(Expression messageExpression) Creates a throw statement for IllegalArgumentException with an expression message.static ThrowillegalArgument(String message) Creates a throw statement for IllegalArgumentException with a simple message.static ThrowillegalState(Expression messageExpression) Creates a throw statement for IllegalStateException with an expression message.static ThrowillegalState(String message) Creates a throw statement for IllegalStateException with a simple message.static ThrownewInstance(ClassRef exceptionClassRef, Expression messageExpression) Creates a throw statement for a new instance of the specified exception class with an expression message.static ThrownewInstance(ClassRef exceptionClassRef, String message) Creates a throw statement for a new instance of the specified exception class with a message.static ThrownewInstance(Class<?> exceptionClass, Expression messageExpression) Creates a throw statement for a new instance of the specified exception class with an expression message.static ThrownewInstance(Class<?> exceptionClass, String message) Creates a throw statement for a new instance of the specified exception class with a message.render()Render the type into aStringfor the purpose of code generation.static ThrowruntimeException(Expression messageExpression) Creates a throw statement for RuntimeException with an expression message.static ThrowruntimeException(String message) Creates a throw statement for RuntimeException with a simple message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.sundr.model.Renderable
tabMethods inherited from interface io.sundr.model.Statement
renderStatement
-
Constructor Details
-
Throw
-
-
Method Details
-
getException
-
getReferences
- Specified by:
getReferencesin interfaceWithReferences
-
render
Description copied from interface:RenderableRender the type into aStringfor the purpose of code generation. This is slightly different from the `toString()` method as `toString()` is mostly needed for logging / debugging and should be idempotent. Regarding idempotency this method may yield different result based on the context it is used even if the internal state of the object does not change. An example of such case, is a reference to class that may change based on the package from which it's refenced.- Specified by:
renderin interfaceRenderable- Returns:
- the
Stringrepresentation of the object as it's meant to appear in the generated code.
-
newInstance
Creates a throw statement for a new instance of the specified exception class with a message.- Parameters:
exceptionClass- The exception classmessage- The exception message- Returns:
- A new Throw statement
-
newInstance
Creates a throw statement for a new instance of the specified exception class with a message.- Parameters:
exceptionClassRef- The exception class referencemessage- The exception message- Returns:
- A new Throw statement
-
newInstance
Creates a throw statement for a new instance of the specified exception class with an expression message.- Parameters:
exceptionClass- The exception classmessageExpression- The exception message expression- Returns:
- A new Throw statement
-
newInstance
Creates a throw statement for a new instance of the specified exception class with an expression message.- Parameters:
exceptionClassRef- The exception class referencemessageExpression- The exception message expression- Returns:
- A new Throw statement
-
runtimeException
Creates a throw statement for RuntimeException with a simple message.- Parameters:
message- The exception message- Returns:
- A new Throw statement
-
runtimeException
Creates a throw statement for RuntimeException with an expression message.- Parameters:
messageExpression- The exception message expression- Returns:
- A new Throw statement
-
illegalArgument
Creates a throw statement for IllegalArgumentException with a simple message.- Parameters:
message- The exception message- Returns:
- A new Throw statement
-
illegalArgument
Creates a throw statement for IllegalArgumentException with an expression message.- Parameters:
messageExpression- The exception message expression- Returns:
- A new Throw statement
-
illegalState
Creates a throw statement for IllegalStateException with a simple message.- Parameters:
message- The exception message- Returns:
- A new Throw statement
-
illegalState
Creates a throw statement for IllegalStateException with an expression message.- Parameters:
messageExpression- The exception message expression- Returns:
- A new Throw statement
-