[
https://issues.apache.org/jira/browse/THRIFT-3446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15047662#comment-15047662
]
Siddharth Jain commented on THRIFT-3446:
----------------------------------------
My own scenario that explains why I really need this feature (if that is what
you meant to ask) is that I am going to use java reflection to populate objects
(which are of type T where T is a generated java class from thrift compiler)
from a mysql db. I have about 10 generated java classes that map to 10 sql
tables. Each class has about 20 fields in it that map to sql columns. The
beauty is that using reflection I don't have to write 10 different parsers to
parse 10 different mysql tables. I have a generic parser. The annotations tell
my parser which field maps to which sql column. Does that explain?
> Add support for annotations
> ---------------------------
>
> Key: THRIFT-3446
> URL: https://issues.apache.org/jira/browse/THRIFT-3446
> Project: Thrift
> Issue Type: Wish
> Components: C# - Compiler, Java - Compiler
> Reporter: Siddharth Jain
> Priority: Minor
>
> I understand currently it is not possible to write a thrift file which when
> compiled will generate java code that can have annotations in it. I am
> working on a project in which I need the fields in generated java classes to
> have annotations on them e.g., in below I have defined a annotation named
> Column that is used on fields in MyClass:
> @Retention(value= RetentionPolicy.RUNTIME)
> @interface Column {
> int value() default -1;
> }
> public class MyClass {
> @Column(0)
> private String stateFP;
>
> @Column(1)
> private String countyFP;
>
> @Column(2)
> private String countyNS;
>
> @Column(3)
> private String geoid;
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)