Skip to content

Commit

Permalink
other(element-template-generator): add static feel into element templ…
Browse files Browse the repository at this point in the history
…ate for boolean and Number properties 6
  • Loading branch information
mathias-vandaele committed Feb 26, 2025
1 parent ac1875d commit 478e8f5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static class BooleanPropertyBuilder extends PropertyBuilder {

private BooleanPropertyBuilder() {}

@Override
public BooleanProperty build() {
if (value != null && !(value instanceof Boolean)) {
throw new IllegalStateException("Value of a boolean property must be a boolean");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static class HiddenPropertyBuilder extends PropertyBuilder {

private HiddenPropertyBuilder() {}

@Override
public HiddenProperty build() {
if (value != null && !(value instanceof String)) {
throw new IllegalStateException("Value of a hidden property must be a string");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static class NumberPropertyBuilder extends PropertyBuilder {

private NumberPropertyBuilder() {}

@Override
public NumberProperty build() {
if (value != null && !(value instanceof Number)) {
throw new IllegalStateException("Value of a Number property must be a Number");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static class StringPropertyBuilder extends PropertyBuilder {

private StringPropertyBuilder() {}

@Override
public StringProperty build() {
if (feel == null) {
feel = FeelMode.optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static class TextPropertyBuilder extends PropertyBuilder {

private TextPropertyBuilder() {}

@Override
public TextProperty build() {
if (feel == null) {
feel = FeelMode.optional;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void process(
case BooleanProperty.BooleanPropertyBuilder $ -> builder.feel(Property.FeelMode.staticFeel);

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'BooleanPropertyBuilder $' is never read.
default -> {
if (annotation.feel() == Property.FeelMode.system_default) {
builder.feel(determineDefaultFeelModeBasedOnContext(context, builder));
builder.feel(determineDefaultFeelModeBasedOnContext(context));
} else {
builder.feel(annotation.feel());
}
Expand Down Expand Up @@ -180,7 +180,7 @@ private Number parseNumber(String value, Class<?> type) {
}

private Property.FeelMode determineDefaultFeelModeBasedOnContext(
final TemplateGenerationContext context, PropertyBuilder builder) {
final TemplateGenerationContext context) {
return context instanceof TemplateGenerationContext.Inbound
? Property.FeelMode.disabled
: Property.FeelMode.optional;
Expand Down

0 comments on commit 478e8f5

Please sign in to comment.