You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Piotr Kozikowski (JIRA)" <ji...@apache.org> on 2009/01/23 15:22:59 UTC

[jira] Issue Comment Edited: (THRIFT-253) Enhance FieldMetaData

    [ https://issues.apache.org/jira/browse/THRIFT-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666544#action_12666544 ] 

pkozikow edited comment on THRIFT-253 at 1/23/09 6:21 AM:
------------------------------------------------------------------

Here is a new patch. 

Main changes:
-isContainer and isStruct refactored as methods
-StructMetaData now contains a "structClass" member instead of "structType"
-FieldMetaData has a private map with metadata maps for struct classes, with methods for adding/getting maps
-The metadata map declaration in the generated code is more readable for deeply nested structures
-Added a test and a new struct to ThriftTest.thrift

Notes:
-exceptions are stored as type struct in the metadata map (no exception type in TType.java)
-typedefs are stored as the types they represent
-the global map in FieldMetaData will only contain entries for loaded classes (e.g. an object of the class has been instantiated)

      was (Author: pkozikow):
    Here is a new patch. 

Main changes:
-isContainer and isStruct refactored as methods
-StructMetaData now contains a "structClass" member instead of "structType"
-FieldMetaData has a private map with metadata maps for struct classes, with methods for adding/getting maps
-The metadata map declaration in the generated code is more readable for deeply nested structures

Notes:
-exceptions are stored as type struct in the metadata map (no exception type in TType.java)
-typedefs are stored as the types they represent
-the global map in FieldMetaData will only contain entries for loaded classes (e.g. an object of the class has been instantiated)
  
> Enhance FieldMetaData
> ---------------------
>
>                 Key: THRIFT-253
>                 URL: https://issues.apache.org/jira/browse/THRIFT-253
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Compiler (Java)
>            Reporter: Nathan Marz
>            Assignee: Piotr Kozikowski
>            Priority: Minor
>         Attachments: thrift-253-v1.patch, thrift-253-v2.patch
>
>
> Having more meta data would be useful in the FieldMetaData structure. Specifically, it should be enhanced to contain information about whether the field is a list, set, map, base type, or another thrift structure. If it's a container type, it should contain information about what types are in the container. For base types and other thrift structures, it should specify the type. There's many ways we could encode this information - here's a first proposal and I'm open to suggestions.The idea is to have a "FieldMetaData", which includes data about the field like field name, "required", "optional", etc. It also includes a "FieldValueMetaData" which would have a subclass for regular objects or for containers, which contain further meta data about the types within.
> // need a better name than "Necessity"
> enum Necessity {
>  REQUIRED, OPTIONAL, DEFAULT
> }
> interface FieldValueMetaData {
> }
> class FieldMetaData {
>  String fieldName;
>  Necessity necessity;
>  FieldValueMetaData valueMetaData;
> }
> class ListFieldMetaData implements FieldValueMetaData {
>  FieldValueMetaData type;
> }
> class SetFieldMetaData implements FieldValueMetaData {
>   FieldValueMetaData type;
> }
> class MapFieldMetaData implements FieldValueMetaData {
>  FieldValueMetaData keyType;
>  FieldValueMetaData valueType;
> }
> class ObjectFieldMetaData implements FieldValueMetaData {
>  Class type;
> }
>   
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.