mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-19 20:15:21 +00:00
Use readConfigurationOr
This commit is contained in:
1 parent
2a3960babc
commit
7ff6b78361
3 files changed
+9
-5
No files matched your search
@@ -6,7 +6,7 @@ public final class JacksonVersion implements ConfigurationValueType {
|
||||
private final boolean useJackson3;
|
||||
|
||||
public static final JacksonVersion _2 = new JacksonVersion(true, false);
|
||||
public static final JacksonVersion _3 = new JacksonVersion(true, false);
|
||||
public static final JacksonVersion _3 = new JacksonVersion(false, true);
|
||||
public static final JacksonVersion _23 = new JacksonVersion(true, true);
|
||||
|
||||
public JacksonVersion(boolean useJackson2, boolean useJackson3) {
|
||||
@@ -43,4 +43,8 @@ public final class JacksonVersion implements ConfigurationValueType {
|
||||
public boolean useJackson3() {
|
||||
return useJackson3;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return useJackson2 || useJackson3;
|
||||
}
|
||||
}
|
||||
@@ -148,8 +148,8 @@ public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
|
||||
ClassLiteralAccess builderClassLiteralAccess = new ClassLiteralAccess(td.sourceEnd, builderClassExpression);
|
||||
MemberValuePair builderMvp = new MemberValuePair("builder".toCharArray(), td.sourceStart, td.sourceEnd, builderClassLiteralAccess);
|
||||
|
||||
JacksonVersion jacksonVersion = annotationNode.getAst().readConfiguration(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION);
|
||||
if (! (jacksonVersion.useJackson2() || jacksonVersion.useJackson3())) {
|
||||
JacksonVersion jacksonVersion = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, JacksonVersion._2);
|
||||
if (! jacksonVersion.isValid()) {
|
||||
annotationNode.addError("Usage: No valid jackson version selected");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
|
||||
return;
|
||||
}
|
||||
|
||||
JacksonVersion jacksonVersion = annotationNode.getAst().readConfiguration(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION);
|
||||
if (! (jacksonVersion.useJackson2() || jacksonVersion.useJackson3())) {
|
||||
JacksonVersion jacksonVersion = annotationNode.getAst().readConfigurationOr(ConfigurationKeys.JACKSONIZED_JACKSON_VERSION, JacksonVersion._2);
|
||||
if (! jacksonVersion.isValid()) {
|
||||
annotationNode.addError("Usage: No valid jackson version selected");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user