Class ExitStatus
- java.lang.Object
- org.springframework.boot.cli.command.status.ExitStatus
public final class ExitStatus extends Object
Encapsulation of the outcome of a command.
Field Summary
Fields Modifier and Type Field Description static ExitStatusERRORGeneric "not OK" exit status with non-zero exit code and hangup=true.static ExitStatusOKGeneric "OK" exit status with zero exit code and hangup=false.
Constructor Summary
Constructors Constructor Description ExitStatus(int code, String name)Create a newExitStatusinstance.ExitStatus(int code, String name, boolean hangup)Create a newExitStatusinstance.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCode()An exit code appropriate for use inSystem.exit().StringgetName()A name describing the outcome.ExitStatushangup()Convert the existing code to a hangup.booleanisHangup()Flag to signal that the caller can (or should) hangup.StringtoString()
Field Detail
OK
public static ExitStatus OK
Generic "OK" exit status with zero exit code and hangup=false.
ERROR
public static ExitStatus ERROR
Generic "not OK" exit status with non-zero exit code and hangup=true.
Constructor Detail
ExitStatus
public ExitStatus(int code, String name)
Create a newExitStatusinstance.- Parameters:
code- the exit codename- the name
ExitStatus
public ExitStatus(int code, String name, boolean hangup)
Create a newExitStatusinstance.- Parameters:
code- the exit codename- the namehangup- true if it is OK for the caller to hangup
Method Detail
getCode
public int getCode()
An exit code appropriate for use inSystem.exit().- Returns:
- an exit code
isHangup
public boolean isHangup()
Flag to signal that the caller can (or should) hangup. A server process with non-daemon threads should set this to false.- Returns:
- the flag
hangup
public ExitStatus hangup()
Convert the existing code to a hangup.- Returns:
- a new ExitStatus with hangup=true