Package com.helger.io.file
Class FileIOError
java.lang.Object
com.helger.io.file.FileIOError
- All Implemented Interfaces:
com.helger.base.state.ISuccessIndicator
@Immutable
public class FileIOError
extends Object
implements com.helger.base.state.ISuccessIndicator
Represents an error with an additional error object.
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionFileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode) Constructor with operation and error code only.FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @NonNull File aFile1) Constructor with operation, error code and one file.FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @NonNull File aFile1, @NonNull File aFile2) Constructor with operation, error code and two files.FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @Nullable File aFile1, @Nullable File aFile2, @Nullable Exception aException) Full constructor with all parameters.FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @NonNull Exception aException) Constructor with operation, error code and an exception. -
Method Summary
Modifier and TypeMethodDescriptionboolean@NonNull EFileIOErrorCode@Nullable Exception@Nullable FilegetFile1()@Nullable FilegetFile2()@NonNull EFileIOOperationbooleanbooleanhasFile1()booleanhasFile2()inthashCode()booleanCheck if this error represents a successful operation.toString()@NonNull FileIOErrorCreate a copy of this error with the error code reset toEFileIOErrorCode.NO_ERROR.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.base.state.ISuccessIndicator
and, isFailure, or
-
Constructor Details
-
FileIOError
Constructor with operation and error code only.- Parameters:
eOperation- The file I/O operation. May not benull.eCode- The error code. May not benull.
-
FileIOError
public FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @NonNull File aFile1) Constructor with operation, error code and one file.- Parameters:
eOperation- The file I/O operation. May not benull.eCode- The error code. May not benull.aFile1- The first file relevant to this error. May not benull.
-
FileIOError
public FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @NonNull File aFile1, @NonNull File aFile2) Constructor with operation, error code and two files.- Parameters:
eOperation- The file I/O operation. May not benull.eCode- The error code. May not benull.aFile1- The first file relevant to this error. May not benull.aFile2- The second file relevant to this error. May not benull.
-
FileIOError
public FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @NonNull Exception aException) Constructor with operation, error code and an exception.- Parameters:
eOperation- The file I/O operation. May not benull.eCode- The error code. May not benull.aException- The exception that occurred. May not benull.
-
FileIOError
public FileIOError(@NonNull EFileIOOperation eOperation, @NonNull EFileIOErrorCode eCode, @Nullable File aFile1, @Nullable File aFile2, @Nullable Exception aException) Full constructor with all parameters.- Parameters:
eOperation- The file I/O operation. May not benull.eCode- The error code. May not benull.aFile1- The first file relevant to this error. May benull.aFile2- The second file relevant to this error. May benull.aException- The exception that occurred. May benull.
-
-
Method Details
-
getOperation
- Returns:
- The operation passed in the constructor. Never
null.
-
getErrorCode
- Returns:
- The error code passed in the constructor. Never
null.
-
isSuccess
public boolean isSuccess()Check if this error represents a successful operation.- Specified by:
isSuccessin interfacecom.helger.base.state.ISuccessIndicator- Returns:
trueif the operation was successful,falseotherwise.
-
getFile1
- Returns:
- The first file relevant to this error. May be
null.
-
hasFile1
public boolean hasFile1()- Returns:
trueif the first file is present,falseif not.
-
getFile2
- Returns:
- The second file relevant to this error. May be
null. This field can only be present, ifgetFile1()is present.
-
hasFile2
public boolean hasFile2()- Returns:
trueif the second file is present,falseif not.
-
getException
- Returns:
- The exception passed in the constructor. May be
null.
-
hasException
public boolean hasException()- Returns:
trueif an exception is present,falseif not.
-
withoutErrorCode
Create a copy of this error with the error code reset toEFileIOErrorCode.NO_ERROR. If the current error code already indicates success,thisis returned.- Returns:
- A non-
nullFileIOErrorwith no error code.
-
equals
-
hashCode
public int hashCode() -
toString
-