Annotation with parameter using annox

339 views Asked by At

I am searching for a way to use "annox" to annotate a generated class. The goal is to add a hibernate annotation to the generated class, that has a constructor value. Here is an example of the desired result:

public class XJCGeneratedClass {

@Enumerated(EnumType.STRING)
Sample sample;
...
}

You see: I have a constructor parameter given to the annotation.

I already have the Part of the @Enumeration working in the correspdonding xsd:

<xs:element name="sample">
<xs:annotation>
    <xs:appinfo>
        <annox:annotate>
                <hs:Enumerated impl="javax.persistence.Enumerated" >
                <!-- WHAT ELSE DO IT NEED TO MAKE ANNOX PRODUCE "@Enumerated(EnumType.STRING)" FOR THIS FIELD? -->
            </hs:Enumerated>
            </annox:annotate>
    </xs:appinfo>
</xs:annotation>

Of course, when I generate my sources an error is yielded because the Annotation does not exist without a Parameter. Thrown error is:

Could not parse the value [ ] into the target class [javax.persistence.EnumType]

I tried a lot (for example including value-Tag), but I cannot add the correct behaviour to add the Enumerated-Annotation with the EnumType.STRING as a parameter.

Does anybody know how to do this?

1

There are 1 answers

0
lexicore On

Have you actually tried:

<hs:Enumerated value="STRING"/>

See the user guide.