Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
chaokunyang committed Nov 2, 2024
1 parent bf53bff commit c1c7125
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

/** A build item that represents a Fury instance. */
public final class FuryBuildItem extends SimpleBuildItem {
private final RuntimeValue<BaseFury> value;
private final RuntimeValue<BaseFury> value;

public FuryBuildItem(RuntimeValue<BaseFury> value) {
this.value = value;
}
public FuryBuildItem(RuntimeValue<BaseFury> value) {
this.value = value;
}

public RuntimeValue<BaseFury> getFury() {
return value;
}
public RuntimeValue<BaseFury> getFury() {
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,45 @@

class FuryProcessor {

private static final String FEATURE = "fury";
private static final DotName FURY_SERIALIZATION =
DotName.createSimple(FurySerialization.class.getName());
private static final String FEATURE = "fury";
private static final DotName FURY_SERIALIZATION = DotName.createSimple(FurySerialization.class.getName());

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}
@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
public void findSerializableClasses(
CombinedIndexBuildItem combinedIndex, BuildProducer<FurySerializerBuildItem> pojoProducer) {
combinedIndex.getIndex().getAnnotations(FURY_SERIALIZATION).stream()
.filter(annotation -> annotation.target().kind() == AnnotationTarget.Kind.CLASS)
.forEach(
i -> {
pojoProducer.produce(new FurySerializerBuildItem(i.target().asClass()));
});
}
@BuildStep
public void findSerializableClasses(
CombinedIndexBuildItem combinedIndex, BuildProducer<FurySerializerBuildItem> pojoProducer) {
combinedIndex.getIndex().getAnnotations(FURY_SERIALIZATION).stream()
.filter(annotation -> annotation.target().kind() == AnnotationTarget.Kind.CLASS)
.forEach(
i -> {
pojoProducer.produce(new FurySerializerBuildItem(i.target().asClass()));
});
}

@BuildStep
void unremovableBeans(
BuildProducer<AdditionalBeanBuildItem> beanProducer,
BuildProducer<UnremovableBeanBuildItem> unremovableBeans) {
beanProducer.produce(AdditionalBeanBuildItem.unremovableOf(FuryProducer.class));
}
@BuildStep
void unremovableBeans(
BuildProducer<AdditionalBeanBuildItem> beanProducer,
BuildProducer<UnremovableBeanBuildItem> unremovableBeans) {
beanProducer.produce(AdditionalBeanBuildItem.unremovableOf(FuryProducer.class));
}

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
public void registerClasses(
FuryBuildItem fury, List<FurySerializerBuildItem> classes, FuryRecorder recorder) {
for (FurySerializerBuildItem item : classes) {
recorder.registerClass(fury.getFury(), item.getClazz(), item.getClassId());
@BuildStep
@Record(ExecutionTime.STATIC_INIT)
public void registerClasses(
FuryBuildItem fury, List<FurySerializerBuildItem> classes, FuryRecorder recorder) {
for (FurySerializerBuildItem item : classes) {
recorder.registerClass(fury.getFury(), item.getClazz(), item.getClassId());
}
}
}

@BuildStep
@Record(ExecutionTime.STATIC_INIT)
public FuryBuildItem setup(
FuryBuildTimeConfig config, BeanContainerBuildItem beanContainer, FuryRecorder recorder) {
return new FuryBuildItem(recorder.createFury(config, beanContainer.getValue()));
}
@BuildStep
@Record(ExecutionTime.STATIC_INIT)
public FuryBuildItem setup(
FuryBuildTimeConfig config, BeanContainerBuildItem beanContainer, FuryRecorder recorder) {
return new FuryBuildItem(recorder.createFury(config, beanContainer.getValue()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
import io.quarkus.builder.item.MultiBuildItem;

public final class FurySerializerBuildItem extends MultiBuildItem {
private final Class<?> clazz;
private final int classId;
private final Class<?> clazz;
private final int classId;

public FurySerializerBuildItem(ClassInfo classInfo) {
clazz = JandexReflection.loadClass(classInfo);
classId = clazz.getDeclaredAnnotation(FurySerialization.class).classId();
}
public FurySerializerBuildItem(ClassInfo classInfo) {
clazz = JandexReflection.loadClass(classInfo);
classId = clazz.getDeclaredAnnotation(FurySerialization.class).classId();
}

public int getClassId() {
return classId;
}
public int getClassId() {
return classId;
}

public Class<?> getClazz() {
return clazz;
}
public Class<?> getClazz() {
return clazz;
}
}

0 comments on commit c1c7125

Please sign in to comment.