Skip to content
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

Support nested annotations #12

Open
G-Ork opened this issue May 22, 2018 · 2 comments
Open

Support nested annotations #12

G-Ork opened this issue May 22, 2018 · 2 comments

Comments

@G-Ork
Copy link
Contributor

G-Ork commented May 22, 2018

Problem

Currently the value node for annotations contains a simple string representation of the values. This makes it hard to parse where annotations are nested. It would be nice to handle annotations recursive to be able to extract the desired information more easy.

Example usage of nested annotations

@Entity
@Table(name="VCUST")
@DiscriminatorValue("VCUST")
@PrimaryKeyJoinColumns({
    @PrimaryKeyJoinColumn(name="CUST_ID",referencedColumnName="ID"),
    @PrimaryKeyJoinColumn(name="CUST_TYPE",referencedColumnName="TYPE")
})
public class ValuedCustomer extends Customer { 
    // body
}

Expected Output

In respect to XSD i would not change the value type to mixed content and prefer a more typed way with a new node.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
    <package name="com.github.markusbernhardt.xmldoclet.simpledata">
        <class name="ClassJPA" qualified="com.github.markusbernhardt.xmldoclet.simpledata.ClassJPA" scope="public" abstract="false" error="false" exception="false" externalizable="false" included="true" serializable="false">
            <class qualified="java.lang.Object"/>
            <constructor name="ClassJPA" signature="()" qualified="com.github.markusbernhardt.xmldoclet.simpledata.ClassJPA" scope="public" final="false" included="true" native="false" synchronized="false" static="false" varArgs="false"/>
            <annotation name="Entity" qualified="javax.persistence.Entity"/>
            <annotation name="Table" qualified="javax.persistence.Table">
                <argument name="name" primitive="false" array="false">
                    <type qualified="java.lang.String"/>
                    <value>VCUST</value>
                </argument>
            </annotation>
            <annotation name="DiscriminatorValue" qualified="javax.persistence.DiscriminatorValue">
                <argument name="value" primitive="false" array="false">
                    <type qualified="java.lang.String"/>
                    <value>VCUST</value>
                </argument>
            </annotation>
            <annotation name="PrimaryKeyJoinColumns" qualified="javax.persistence.PrimaryKeyJoinColumns">
                <argument name="value" primitive="false" array="true">
                    <type qualified="javax.persistence.PrimaryKeyJoinColumn" dimension="[]"/>
                    <annotation name="PrimaryKeyJoinColumn" qualified="javax.persistence.PrimaryKeyJoinColumn">
                        <argument name="name" primitive="false" array="false">
                            <type qualified="java.lang.String"/>
                            <value>CUST_ID</value>
                        </argument>
                        <argument name="referencedColumnName" primitive="false" array="false">
                            <type qualified="java.lang.String"/>
                            <value>ID</value>
                        </argument>
                    </annotation>
                    <annotation name="PrimaryKeyJoinColumn" qualified="javax.persistence.PrimaryKeyJoinColumn">
                        <argument name="name" primitive="false" array="false">
                            <type qualified="java.lang.String"/>
                            <value>CUST_TYPE</value>
                        </argument>
                        <argument name="referencedColumnName" primitive="false" array="false">
                            <type qualified="java.lang.String"/>
                            <value>TYPE</value>
                        </argument>
                    </annotation>
                </argument>
            </annotation>
        </class>
    </package>
</root>
G-Ork added a commit to G-Ork/xml-doclet that referenced this issue May 22, 2018
MarkusBernhardt added a commit that referenced this issue May 28, 2018
Support nested annotations #12
@ancgate
Copy link

ancgate commented Jun 6, 2019

What is the fixed on this? I have a ValuedCustomer and Orders and I want to do a bidirectional relationship in hibernate. How do I do this? Thanks

@G-Ork
Copy link
Contributor Author

G-Ork commented Mar 9, 2020

Hi, thank you for merging.
Would you mind to release the version?

Recently our artifact repo killed the snapshot. Would be nice to have the fix available in central as an release.

Best regards G"

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