Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aas_core_codegen/java/lib/_generate_jsonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def _generate_from_object_body(
foreach_writer = io.StringIO()
foreach_writer.write(
f"""\
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {{
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {{
{I}final Map.Entry<String, JsonNode> keyValue = iterator.next();
{I}final String key = keyValue.getKey();
"""
Expand Down
18 changes: 6 additions & 12 deletions aas_core_codegen/java/lib/_generate_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,21 +1053,14 @@ def _generate_mandatory_constructor(
"""
Generate a default constructor for the given concrete class ``cls``.

Return empty string if there is an empty constructor or no default constructor
can be constructed.
Return empty string if there is an empty constructor.
"""
if (
len(cls.constructor.arguments) == 0
and len(cls.constructor.inlined_statements) == 0
):
return Stripped(""), None

if all(
isinstance(arg.type_annotation, intermediate.OptionalTypeAnnotation)
for arg in cls.constructor.arguments
):
return Stripped(""), None

cls_name = java_naming.class_name(cls.name)

blocks: List[str] = []
Expand All @@ -1085,9 +1078,9 @@ def _generate_mandatory_constructor(

arg_codes.append(Stripped(f"{arg_type} {arg_name}"))

assert len(arg_codes) > 0

if len(arg_codes) == 1:
if len(arg_codes) == 0:
blocks.append(f"public {cls_name}() {{")
elif len(arg_codes) == 1:
blocks.append(f"public {cls_name}({arg_codes[0]}) {{")
else:
arg_block = ",\n".join(arg_codes)
Expand Down Expand Up @@ -1170,7 +1163,8 @@ def _generate_mandatory_constructor(
else:
assert_never(stmt)

blocks.append("\n".join(textwrap.indent(stmt_code, I) for stmt_code in body))
if len(body) > 0:
blocks.append("\n".join(textwrap.indent(stmt_code, I) for stmt_code in body))

blocks.append("}")

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public class AdministrativeInformation implements IAdministrativeInformation {
*/
private String templateId;

public AdministrativeInformation() {
}

public AdministrativeInformation(
List<IEmbeddedDataSpecification> embeddedDataSpecifications,
String version,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public class Capability implements ICapability {
*/
private List<IEmbeddedDataSpecification> embeddedDataSpecifications;

public Capability() {
}

public Capability(
List<IExtension> extensions,
String category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public class Environment implements IEnvironment {
*/
private List<IConceptDescription> conceptDescriptions;

public Environment() {
}

public Environment(
List<IAssetAdministrationShell> assetAdministrationShells,
List<ISubmodel> submodels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ public class MultiLanguageProperty implements IMultiLanguageProperty {
*/
private IReference valueId;

public MultiLanguageProperty() {
}

public MultiLanguageProperty(
List<IExtension> extensions,
String category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public class Operation implements IOperation {
*/
private List<IOperationVariable> inoutputVariables;

public Operation() {
}

public Operation(
List<IExtension> extensions,
String category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ public class ReferenceElement implements IReferenceElement {
*/
private IReference value;

public ReferenceElement() {
}

public ReferenceElement(
List<IExtension> extensions,
String category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public class SubmodelElementCollection implements ISubmodelElementCollection {
*/
private List<ISubmodelElement> value;

public SubmodelElementCollection() {
}

public SubmodelElementCollection(
List<IExtension> extensions,
String category,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ private static Reporting.Result<Item> tryItemFrom(JsonNode node) {

String theName = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -481,7 +481,7 @@ private static Reporting.Result<ChildA> tryChildAFromObject(JsonNode node) {
Long theAOnly = null;
String theOptionalText = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -548,7 +548,7 @@ private static Reporting.Result<ChildB> tryChildBFromObject(JsonNode node) {
Long theBOnly = null;
String theOptionalText = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -721,7 +721,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
byte[] theOptionalData = null;
ParentOrItem theOptionalMember = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
Long theOptionalNumber = null;
Double theOptionalRatio = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ private static Reporting.Result<ChildA> tryChildAFromObject(JsonNode node) {
Long theNumber = null;
Long theAOnly = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -462,7 +462,7 @@ private static Reporting.Result<ChildB> tryChildBFrom(JsonNode node) {
private static Reporting.Result<ChildB> tryChildBFromObject(JsonNode node) {
Long theNumber = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -508,7 +508,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
IParent theParent = null;
String theOptionalText = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ private static Reporting.Result<Item> tryItemFrom(JsonNode node) {
Kind theMaybeKind = null;
List<String> theMaybeTexts = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -374,7 +374,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
List<IItem> theItems = null;
IItem theMaybeItem = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
List<Kind> theKinds = null;
List<String> theOptionalTexts = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -410,7 +410,7 @@ private static Reporting.Result<Grouped> tryGroupedFrom(JsonNode node) {

List<Set<String>> theGroups = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
Long theCount = null;
Double theRatio = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {

SomeEnum theSomeEnum = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
String theSomeString = null;
byte[] theSomeBytes = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private static Reporting.Result<QueryCondition> tryQueryConditionFrom(JsonNode n
String theEq = null;
String theNotEq = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class QueryCondition implements IQueryCondition {
*/
private String notEq;

public QueryCondition() {
}

public QueryCondition(
String eq,
String notEq) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ private static Reporting.Result<Branch> tryBranchFromObject(JsonNode node) {
String theIdentifier = null;
String theDescription = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -466,7 +466,7 @@ private static Reporting.Result<Leaf> tryLeafFromObject(JsonNode node) {
String theDescription = null;
Long theValue = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -552,7 +552,7 @@ private static Reporting.Result<Blossom> tryBlossomFromObject(JsonNode node) {
Long theValue = null;
String theDetails = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -673,7 +673,7 @@ private static Reporting.Result<PlainMarker> tryPlainMarkerFrom(JsonNode node) {
* @param node JSON object to be parsed
*/
private static Reporting.Result<PlainMarker> tryPlainMarkerFromObject(JsonNode node) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();

Expand Down Expand Up @@ -702,7 +702,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
INode theSomeChoice = null;
IBranch theSomethingWithoutChoice = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -755,7 +755,7 @@ private static Reporting.Result<Container> tryContainerFrom(JsonNode node) {
INode theNode = null;
ISomething theSomething = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
return notAJsonObject(node);
}

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {

Result theSomeResult = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
Tuple2<String, Double> theSomePair = null;
Double theSomeOptionalFloat = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ private static Reporting.Result<Item> tryItemFrom(JsonNode node) {

List<String> theTexts = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down Expand Up @@ -394,7 +394,7 @@ private static Reporting.Result<Something> trySomethingFrom(JsonNode node) {
List<String> theTexts = null;
List<IItem> theItems = null;

for (Iterator<Map.Entry<String, JsonNode>> iterator = node.fields(); iterator.hasNext(); ) {
for (Iterator<Map.Entry<String, JsonNode>> iterator = node.properties().iterator(); iterator.hasNext(); ) {
final Map.Entry<String, JsonNode> keyValue = iterator.next();
final String key = keyValue.getKey();
final JsonNode value = keyValue.getValue();
Expand Down
Loading
Loading