Skip to content

Commit fcef687

Browse files
committed
refactor: updated code to fix linter issue
1 parent 653af60 commit fcef687

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

src/main/java/io/apimatic/coreinterfaces/security/VerificationResult.java

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,17 @@ public interface VerificationResult {
3030
* @return a success result
3131
*/
3232
static VerificationResult success() {
33-
return DefaultImpl.SUCCESS;
33+
return new VerificationResult() {
34+
@Override
35+
public boolean isSuccess() {
36+
return true;
37+
}
38+
39+
@Override
40+
public List<String> getErrors() {
41+
return Collections.emptyList();
42+
}
43+
};
3444
}
3545

3646
/**
@@ -40,37 +50,17 @@ static VerificationResult success() {
4050
* @return a failure result
4151
*/
4252
static VerificationResult failure(String... errors) {
43-
return new DefaultImpl(errors);
44-
}
45-
46-
/**
47-
* Default hidden implementation inside the interface.
48-
*/
49-
class DefaultImpl implements VerificationResult {
50-
private static final VerificationResult SUCCESS = new DefaultImpl();
51-
52-
private final List<String> errors;
53-
54-
private DefaultImpl(String... errors) {
55-
this.errors = Collections.unmodifiableList(errors != null ?
56-
Arrays.asList(errors) : Collections.emptyList());
57-
}
58-
59-
@Override
60-
public boolean isSuccess() {
61-
return errors.isEmpty();
62-
}
63-
64-
@Override
65-
public List<String> getErrors() {
66-
return errors;
67-
}
53+
return new VerificationResult() {
54+
@Override
55+
public boolean isSuccess() {
56+
return errors == null;
57+
}
6858

69-
@Override
70-
public String toString() {
71-
return isSuccess()
72-
? "VerificationResult{success}"
73-
: "VerificationResult{errors=" + errors + "}";
74-
}
59+
@Override
60+
public List<String> getErrors() {
61+
return Collections.unmodifiableList(errors != null
62+
? Arrays.asList(errors) : Collections.emptyList());
63+
}
64+
};
7565
}
76-
}
66+
}

0 commit comments

Comments
 (0)