-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
817 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
245 changes: 138 additions & 107 deletions
245
...cessor/src/main/java/io/github/sheikah45/fx2j/processor/internal/ObjectNodeProcessor.java
Large diffs are not rendered by default.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
...-processor/src/main/java/io/github/sheikah45/fx2j/processor/internal/model/CodeValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package io.github.sheikah45.fx2j.processor.internal.model; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public sealed interface CodeValue { | ||
|
||
sealed interface ArrayInitialization extends CodeValue { | ||
record Declared(java.lang.reflect.Type componentType, List<CodeValue> values) implements ArrayInitialization { | ||
public Declared { | ||
Objects.requireNonNull(componentType, "componentType cannot be null"); | ||
Objects.requireNonNull(values, "values cannot be null"); | ||
values = List.copyOf(values); | ||
} | ||
} | ||
record Sized(java.lang.reflect.Type componentType, int size) implements ArrayInitialization { | ||
public Sized { | ||
Objects.requireNonNull(componentType, "componentType cannot be null"); | ||
} | ||
} | ||
} | ||
record Null() implements CodeValue {} | ||
record Char(char value) implements CodeValue {} | ||
record Literal(java.lang.String value) implements CodeValue { | ||
public Literal { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
} | ||
} | ||
record String(java.lang.String value) implements CodeValue { | ||
public String { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
} | ||
} | ||
record Type(java.lang.reflect.Type type) implements CodeValue { | ||
public Type { | ||
Objects.requireNonNull(type, "type cannot be null"); | ||
} | ||
} | ||
record Enum(java.lang.Enum<?> value) implements CodeValue { | ||
public Enum { | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
} | ||
} | ||
record MethodCall(CodeValue receiver, java.lang.String method, List<CodeValue> args) implements CodeValue { | ||
public MethodCall { | ||
Objects.requireNonNull(receiver, "receiver cannot be null"); | ||
Objects.requireNonNull(method, "method cannot be null"); | ||
Objects.requireNonNull(args, "args cannot be null"); | ||
args = List.copyOf(args); | ||
} | ||
} | ||
record FieldAccess(CodeValue receiver, java.lang.String field) implements CodeValue { | ||
public FieldAccess { | ||
Objects.requireNonNull(receiver, "receiver cannot be null"); | ||
Objects.requireNonNull(field, "field cannot be null"); | ||
} | ||
} | ||
record Assignment(java.lang.reflect.Type type, java.lang.String identifier, CodeValue value) implements CodeValue { | ||
public Assignment { | ||
Objects.requireNonNull(type, "type cannot be null"); | ||
Objects.requireNonNull(identifier, "identifier cannot be null"); | ||
Objects.requireNonNull(value, "value cannot be null"); | ||
} | ||
} | ||
} |
13 changes: 10 additions & 3 deletions
13
...sor/src/main/java/io/github/sheikah45/fx2j/processor/internal/model/ExpressionResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
package io.github.sheikah45.fx2j.processor.internal.model; | ||
|
||
import com.squareup.javapoet.CodeBlock; | ||
|
||
import java.lang.reflect.Type; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public record ExpressionResult(Type type, String identifier, CodeBlock initializationCode) {} | ||
public record ExpressionResult(Type type, String identifier, List<CodeValue.Assignment> initializers) { | ||
public ExpressionResult { | ||
Objects.requireNonNull(type, "type cannot be null"); | ||
Objects.requireNonNull(identifier, "identifier cannot be null"); | ||
Objects.requireNonNull(initializers, "initializers cannot be null"); | ||
initializers = List.copyOf(initializers); | ||
} | ||
} |
Oops, something went wrong.