This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feat/code-gen-1.9
in repository https://gitbox.apache.org/repos/asf/plc4x-build-tools.git
The following commit(s) were added to refs/heads/feat/code-gen-1.9 by this push:
new 0fc1444 feat: Added support for "state" fields.
0fc1444 is described below
commit 0fc14445b2c75e2e0ddd972a92a3ce4774321b13
Author: Christofer Dutz <[email protected]>
AuthorDate: Thu Aug 28 16:19:22 2025 +0200
feat: Added support for "state" fields.
---
code-generation/RELEASE_NOTES | 2 ++
.../types/definitions/ComplexTypeDefinition.java | 7 +++++
.../codegenerator/types/fields/StateField.java | 31 ++++++++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/code-generation/RELEASE_NOTES b/code-generation/RELEASE_NOTES
index 4d054c5..ad8a870 100644
--- a/code-generation/RELEASE_NOTES
+++ b/code-generation/RELEASE_NOTES
@@ -3,6 +3,8 @@
New Features
------------
+- Added a new type for 'constants'
+- Added a new field type for 'state'
Incompatible changes
--------------------
diff --git
a/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/definitions/ComplexTypeDefinition.java
b/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/definitions/ComplexTypeDefinition.java
index 96524c8..be13443 100644
---
a/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/definitions/ComplexTypeDefinition.java
+++
b/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/definitions/ComplexTypeDefinition.java
@@ -63,6 +63,13 @@ public interface ComplexTypeDefinition extends
TypeDefinition {
*/
List<VirtualField> getAllVirtualFields();
+ /**
+ * Get only the fields which are of type StateField.
+ *
+ * @return all state fields
+ */
+ List<StateField> getStateFields();
+
/**
* Get only the fields which are of type ConstField.
*
diff --git
a/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/fields/StateField.java
b/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/fields/StateField.java
new file mode 100644
index 0000000..370ef3c
--- /dev/null
+++
b/code-generation/types-base/src/main/java/org/apache/plc4x/plugins/codegenerator/types/fields/StateField.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.plc4x.plugins.codegenerator.types.fields;
+
+import org.apache.plc4x.plugins.codegenerator.types.terms.Term;
+
+public interface StateField extends PropertyField {
+
+ default String getTypeName() {
+ return "state";
+ }
+
+ Term getValueExpression();
+
+}