0

I have this class

@Generated(value="Dali", date="2014-07-29T08:43:32.358-0400")
@StaticMetamodel(Country.class)
public class Country_ {
    public static volatile SingularAttribute<Country, Long> id;
    public static volatile SingularAttribute<Country, String> name;
    public static volatile SingularAttribute<Country, Boolean> active;
}

that I would like to iterate in some way to get the properties and retrieve them in a list

(yes, this one has only three properties, but I do have others with more)

for example

public List<String> retriveEntityProperties()
{
    List<String> parameters = new LinkedList<String>();

    for(SingularAttribute<Country, String> att : PersonaFisica_.attributes())
    {

        parameters.add(att.getName());
    }


    return parameters;
}

thanks

icarus
  • 319
  • 2
  • 4

1 Answers1

0

If I understand your question correctly, you can use Java reflection:

List<String> attributeNames = new ArrayList<String>();
for (Field field : Country_.class.getFields()) {
    attributeNames.add(field.getName());
}
Brian Vosburgh
  • 3,146
  • 1
  • 18
  • 18