Skip to content

[java] Generated DTO fields for set fields aren't given public scope #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidtwomey opened this issue Apr 3, 2025 · 2 comments
Closed

Comments

@davidtwomey
Copy link

davidtwomey commented Apr 3, 2025

This is related to #1012 but for set fields.

When you specify a set field type (see example below), the Dto generated has private setter scope.

<?xml version="1.0" encoding="UTF-8"?>
<messageSchema
  package="com.example"
  id="777"
  version="1"
  semanticVersion="1.0.0">

  <types>
    <set name="SetType" encodingType="uint16">
      <choice name="A">0</choice>
      <choice name="B">1</choice>
      <choice name="C">2</choice>
    </set>

    <composite name="messageHeader" description="Message identifiers and length of message root">
      <type name="blockLength" primitiveType="uint16"/>
      <type name="templateId" primitiveType="uint16"/>
      <type name="schemaId" primitiveType="uint16"/>
      <type name="version" primitiveType="uint16"/>
    </composite>
  </types>


  <message name="SimpleMessage" id="1">
    <field name="setField" id="1" type="SetType"/>
  </message>

</messageSchema>

Expected behaviour is public setters

Produces a Dto type with private setters.

public final class SetTypeDto
{
    boolean a;
    boolean b;
    boolean c;

    public boolean a()
    {
        return a;
    }

    SetTypeDto a(boolean value) // Should be public
    {
        a = value;
        return this;
    }

    public boolean b()
    {
        return b;
    }

    SetTypeDto b(boolean value) // Should be public
    {
        b = value;
        return this;
    }

// ...
@davidtwomey
Copy link
Author

@vyazelenko - is this also an easy fix?

@vyazelenko
Copy link
Contributor

Fixed with bdb3255.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants