Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public final class ReflectiveClassBuildItem extends MultiBuildItem {
private final boolean constructors;
private final boolean finalFieldsWritable;
private final boolean weak;
private final boolean serialization;

public ReflectiveClassBuildItem(boolean methods, boolean fields, Class<?>... className) {
this(true, methods, fields, className);
Expand All @@ -30,6 +31,11 @@ public ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean f

private ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean fields, boolean finalFieldsWritable,
boolean weak, Class<?>... className) {
this(constructors, methods, fields, false, false, false, className);
}

private ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean fields, boolean finalFieldsWritable,
boolean weak, boolean serialization, Class<?>... className) {
List<String> names = new ArrayList<>();
for (Class<?> i : className) {
if (i == null) {
Expand All @@ -43,6 +49,7 @@ private ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean
this.constructors = constructors;
this.finalFieldsWritable = finalFieldsWritable;
this.weak = weak;
this.serialization = serialization;
}

public ReflectiveClassBuildItem(boolean methods, boolean fields, String... className) {
Expand All @@ -53,12 +60,26 @@ public ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean f
this(constructors, methods, fields, false, false, className);
}

public ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean fields, boolean serialization,
String... className) {
this(constructors, methods, fields, false, false, serialization, className);
}

public static ReflectiveClassBuildItem weakClass(String... className) {
return new ReflectiveClassBuildItem(true, true, true, false, true, className);
}

public static ReflectiveClassBuildItem serializationClass(String... className) {
return new ReflectiveClassBuildItem(false, false, false, false, false, true, className);
}

private ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean fields, boolean finalFieldsWritable,
boolean weak, String... className) {
this(constructors, methods, fields, finalFieldsWritable, weak, false, className);
}

private ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean fields, boolean finalFieldsWritable,
boolean weak, boolean serialization, String... className) {
for (String i : className) {
if (i == null) {
throw new NullPointerException();
Expand All @@ -70,6 +91,7 @@ private ReflectiveClassBuildItem(boolean constructors, boolean methods, boolean
this.constructors = constructors;
this.finalFieldsWritable = finalFieldsWritable;
this.weak = weak;
this.serialization = serialization;
}

public List<String> getClassNames() {
Expand All @@ -96,6 +118,10 @@ public boolean isWeak() {
return weak;
}

public boolean isSerialization() {
return serialization;
}

public static Builder builder(Class<?>... className) {
String[] classNameStrings = stream(className)
.map(aClass -> {
Expand All @@ -122,6 +148,7 @@ public static class Builder {
private boolean fields;
private boolean finalFieldsWritable;
private boolean weak;
private boolean serialization;

private Builder() {
}
Expand Down Expand Up @@ -156,6 +183,11 @@ public Builder weak(boolean weak) {
return this;
}

public Builder serialization(boolean serialize) {
this.serialization = serialization;
return this;
}

public ReflectiveClassBuildItem build() {
return new ReflectiveClassBuildItem(constructors, methods, fields, finalFieldsWritable, weak, className);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public final class ReflectiveHierarchyBuildItem extends MultiBuildItem {
private final Predicate<FieldInfo> ignoreFieldPredicate;
private final Predicate<MethodInfo> ignoreMethodPredicate;
private final String source;
private final boolean serialization;

/**
* @deprecated Use the Builder instead.
Expand Down Expand Up @@ -104,17 +105,19 @@ public ReflectiveHierarchyBuildItem(Type type, Predicate<DotName> ignoreTypePred
@Deprecated
public ReflectiveHierarchyBuildItem(Type type, IndexView index, Predicate<DotName> ignoreTypePredicate, String source) {
this(type, index, ignoreTypePredicate, DefaultIgnoreFieldPredicate.INSTANCE, DefaultIgnoreMethodPredicate.INSTANCE,
source);
source, false);
}

private ReflectiveHierarchyBuildItem(Type type, IndexView index, Predicate<DotName> ignoreTypePredicate,
Predicate<FieldInfo> ignoreFieldPredicate, Predicate<MethodInfo> ignoreMethodPredicate, String source) {
Predicate<FieldInfo> ignoreFieldPredicate, Predicate<MethodInfo> ignoreMethodPredicate, String source,
boolean serialization) {
this.type = type;
this.index = index;
this.ignoreTypePredicate = ignoreTypePredicate;
this.ignoreFieldPredicate = ignoreFieldPredicate;
this.ignoreMethodPredicate = ignoreMethodPredicate;
this.source = source;
this.serialization = serialization;
}

public Type getType() {
Expand All @@ -141,6 +144,10 @@ public boolean hasSource() {
return source != null;
}

public boolean isSerialization() {
return serialization;
}

public String getSource() {
return source;
}
Expand All @@ -153,6 +160,7 @@ public static class Builder {
private Predicate<FieldInfo> ignoreFieldPredicate = DefaultIgnoreFieldPredicate.INSTANCE;
private Predicate<MethodInfo> ignoreMethodPredicate = DefaultIgnoreMethodPredicate.INSTANCE;
private String source = UNKNOWN_SOURCE;
private boolean serialization;

public Builder type(Type type) {
this.type = type;
Expand Down Expand Up @@ -184,9 +192,14 @@ public Builder source(String source) {
return this;
}

public Builder serialization(boolean serialization) {
this.serialization = serialization;
return this;
}

public ReflectiveHierarchyBuildItem build() {
return new ReflectiveHierarchyBuildItem(type, index, ignoreTypePredicate, ignoreFieldPredicate,
ignoreMethodPredicate, source);
ignoreMethodPredicate, source, serialization);
}
}

Expand Down
Loading