Skip to content

Commit

Permalink
minor naming changes
Browse files Browse the repository at this point in the history
Signed-off-by: David Kral <[email protected]>
  • Loading branch information
Verdent committed Aug 3, 2023
1 parent 42fc56d commit b3b0444
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
import java.util.List;
import java.util.function.Consumer;

abstract class AnnotatableComponent extends CommonComponent {
abstract class AnnotatedComponent extends CommonComponent {

private final List<Annotation> annotations;

AnnotatableComponent(Builder<?, ?> builder) {
AnnotatedComponent(Builder<?, ?> builder) {
super(builder);
annotations = List.copyOf(builder.annotations);
}
Expand All @@ -38,7 +38,7 @@ List<Annotation> annotations() {
return annotations;
}

static abstract class Builder<B extends Builder<B, T>, T extends AnnotatableComponent> extends CommonComponent.Builder<B, T> {
static abstract class Builder<B extends Builder<B, T>, T extends AnnotatedComponent> extends CommonComponent.Builder<B, T> {

private final List<Annotation> annotations = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
public final class Annotation extends CommonComponent {

private final List<AnnotParameter> parameters;
private final List<AnnotationParameter> parameters;

private Annotation(Builder builder) {
super(builder);
Expand Down Expand Up @@ -88,15 +88,15 @@ void writeComponent(ModelWriter writer, Set<String> declaredTokens, ImportOrgani
if (!parameters.isEmpty()) {
writer.write("(");
if (parameters.size() == 1) {
AnnotParameter parameter = parameters.get(0);
AnnotationParameter parameter = parameters.get(0);
if (parameter.name().equals("value")) {
writer.write(parameter.value());
} else {
parameter.writeComponent(writer, declaredTokens, imports, classType);
}
} else {
boolean first = true;
for (AnnotParameter parameter : parameters) {
for (AnnotationParameter parameter : parameters) {
if (first) {
first = false;
} else {
Expand All @@ -120,7 +120,7 @@ void addImports(ImportOrganizer.Builder imports) {
*/
public static final class Builder extends CommonComponent.Builder<Builder, Annotation> {

private final Map<String, AnnotParameter> parameters = new LinkedHashMap<>();
private final Map<String, AnnotationParameter> parameters = new LinkedHashMap<>();

private Builder() {
}
Expand Down Expand Up @@ -168,9 +168,9 @@ public Builder addParameter(String name, Object value) {
* @param consumer annotation parameter builder consumer
* @return updated builder instance
*/
public Builder addParameter(Consumer<AnnotParameter.Builder> consumer) {
public Builder addParameter(Consumer<AnnotationParameter.Builder> consumer) {
Objects.requireNonNull(consumer);
AnnotParameter.Builder builder = AnnotParameter.builder();
AnnotationParameter.Builder builder = AnnotationParameter.builder();
consumer.accept(builder);
return addParameter(builder.build());
}
Expand All @@ -181,7 +181,7 @@ public Builder addParameter(Consumer<AnnotParameter.Builder> consumer) {
* @param builder annotation parameter builder
* @return updated builder instance
*/
public Builder addParameter(AnnotParameter.Builder builder) {
public Builder addParameter(AnnotationParameter.Builder builder) {
Objects.requireNonNull(builder);
return addParameter(builder.build());
}
Expand All @@ -192,7 +192,7 @@ public Builder addParameter(AnnotParameter.Builder builder) {
* @param parameter annotation parameter
* @return updated builder instance
*/
public Builder addParameter(AnnotParameter parameter) {
public Builder addParameter(AnnotationParameter parameter) {
Objects.requireNonNull(parameter);
parameters.put(parameter.name(), parameter);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
/**
* Annotation parameter model.
*/
public final class AnnotParameter extends CommonComponent {
public final class AnnotationParameter extends CommonComponent {

private final String value;

private AnnotParameter(Builder builder) {
private AnnotationParameter(Builder builder) {
super(builder);
this.value = resolveValueToString(builder.type(), builder.value);
}
Expand Down Expand Up @@ -65,19 +65,19 @@ String value() {
return value;
}

public static final class Builder extends CommonComponent.Builder<Builder, AnnotParameter> {
public static final class Builder extends CommonComponent.Builder<Builder, AnnotationParameter> {

private Object value;

private Builder() {
}

@Override
public AnnotParameter build() {
public AnnotationParameter build() {
if (value == null || name() == null) {
throw new ClassModelException("Annotation parameter needs to have value and type set");
}
return new AnnotParameter(this);
return new AnnotationParameter(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/**
* Abstract class type model. Contains common logic for all class related models.
*/
public abstract class AbstractClass extends AnnotatableComponent {
public abstract class ClassBase extends AnnotatedComponent {

private final boolean isFinal;
private final boolean isAbstract;
Expand All @@ -51,7 +51,7 @@ public abstract class AbstractClass extends AnnotatableComponent {
private final ClassType classType;
private final Type superType;

AbstractClass(Builder<?, ?> builder) {
ClassBase(Builder<?, ?> builder) {
super(builder);
this.isFinal = builder.isFinal;
this.isAbstract = builder.isAbstract;
Expand Down Expand Up @@ -241,8 +241,8 @@ ClassType classType() {
return classType;
}

public static abstract class Builder<B extends Builder<B, T>, T extends AbstractClass>
extends AnnotatableComponent.Builder<B, T> {
public static abstract class Builder<B extends Builder<B, T>, T extends ClassBase>
extends AnnotatedComponent.Builder<B, T> {

private final Set<Method> methods = new LinkedHashSet<>();
private final Set<Method> staticMethods = new HashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Entry point to create class model.
* This model contain all needed information for each generated type and handles resulting generation.
*/
public final class ClassModel extends AbstractClass {
public final class ClassModel extends ClassBase {

/**
* Padding token used for identifying extra padding requirement for content formatting.
Expand Down Expand Up @@ -133,7 +133,7 @@ public String toString() {
/**
* Fluent API builder for {@link ClassModel}.
*/
public static final class Builder extends AbstractClass.Builder<Builder, ClassModel> {
public static final class Builder extends ClassBase.Builder<Builder, ClassModel> {

private String packageName = "";
private String licenseHeader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* Constructor model.
*/
public final class Constructor extends AbstractMethod {
public final class Constructor extends Executable {

private Constructor(Builder builder) {
super(builder);
Expand Down Expand Up @@ -75,7 +75,7 @@ void writeComponent(ModelWriter writer, Set<String> declaredTokens, ImportOrgani
/**
* Fluent API builder for {@link Constructor}.
*/
public static final class Builder extends AbstractMethod.Builder<Builder, Constructor> {
public static final class Builder extends Executable.Builder<Builder, Constructor> {

private Builder() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@

import io.helidon.common.types.TypeName;

abstract class AbstractMethod extends AnnotatableComponent {
abstract class Executable extends AnnotatedComponent {

private final Content content;
private final List<Parameter> parameters;
private final List<Type> exceptions;

AbstractMethod(Builder<?, ?> builder) {
Executable(Builder<?, ?> builder) {
super(builder);
this.content = builder.contentBuilder.build();
this.parameters = List.copyOf(builder.parameters.values());
Expand Down Expand Up @@ -84,8 +84,8 @@ boolean hasBody() {
return content.hasBody();
}

static abstract class Builder<B extends Builder<B, T>, T extends AbstractMethod>
extends AnnotatableComponent.Builder<B, T> {
static abstract class Builder<B extends Builder<B, T>, T extends Executable>
extends AnnotatedComponent.Builder<B, T> {

private final Map<String, Parameter> parameters = new LinkedHashMap<>();
private final Set<Type> exceptions = new LinkedHashSet<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Field model representation.
*/
public final class Field extends AnnotatableComponent implements Comparable<Field> {
public final class Field extends AnnotatedComponent implements Comparable<Field> {

private final Content defaultValue;
private final boolean isFinal;
Expand Down Expand Up @@ -98,7 +98,7 @@ public String toString() {
/**
* Fluent API builder for {@link Field}.
*/
public static final class Builder extends AnnotatableComponent.Builder<Builder, Field> {
public static final class Builder extends AnnotatedComponent.Builder<Builder, Field> {

private final Content.Builder defaultValueBuilder = Content.builder();
private boolean isFinal = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Inner class model.
*/
public final class InnerClass extends AbstractClass {
public final class InnerClass extends ClassBase {

//Collected directly specified imports when building this class
private final ImportOrganizer.Builder imports;
Expand All @@ -41,7 +41,7 @@ ImportOrganizer.Builder imports() {
return imports;
}

public static final class Builder extends AbstractClass.Builder<Builder, InnerClass> {
public static final class Builder extends ClassBase.Builder<Builder, InnerClass> {

private Builder() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Model of the method which should be created in the specific type.
*/
public final class Method extends AbstractMethod implements Comparable<Method> {
public final class Method extends Executable implements Comparable<Method> {

private final Map<String, TypeArgument> declaredTokens;
private final boolean isDefault;
Expand Down Expand Up @@ -237,7 +237,7 @@ public String toString() {
/**
* Fluent API builder for {@link Method}.
*/
public static final class Builder extends AbstractMethod.Builder<Builder, Method> {
public static final class Builder extends Executable.Builder<Builder, Method> {

private final Map<String, TypeArgument> declaredTokens = new LinkedHashMap<>();
private boolean isDefault = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/**
* Method parameter model.
*/
public final class Parameter extends AnnotatableComponent {
public final class Parameter extends AnnotatedComponent {

private final boolean optional;
private final List<String> description;
Expand Down Expand Up @@ -90,7 +90,7 @@ List<String> description() {
/**
* Fluent API builder for {@link Parameter}.
*/
public static final class Builder extends AnnotatableComponent.Builder<Builder, Parameter> {
public static final class Builder extends AnnotatedComponent.Builder<Builder, Parameter> {

private boolean optional = false;
private final List<String> description = new ArrayList<>();
Expand Down

0 comments on commit b3b0444

Please sign in to comment.