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

ProtobufIDLGenerator是否可以提供一个重载的getIDL(Class<?> cls)方法? #23

Closed
beykery opened this issue Jun 13, 2015 · 4 comments
Milestone

Comments

@beykery
Copy link

beykery commented Jun 13, 2015

ProtobufIDLGenerator目前只有getIDL(Class cls)一个public方法,我们还是需要一个这样的方法: getIDL(Class cls,Set<Class> cachedTypes,Set> cachedEnumTypes) 因为有这个方法的话,就可以避免重复生成同一个类的idl;比如A类引用了B类,C类也引用了B类,当生成A的idl后其实已经生成了B的idl,再调用getIDL(Class cls)传入C的时候,又一次生成B, 所以把两个cache作为参数传入还是有意义的。我目前是在我们的项目里修改这个ProtobufIDLGenerator并提供这个getIDL(Class cls,Set<Class> cachedTypes,Set> cachedEnumTypes) 方法的。

@xiemalin
Copy link
Contributor

大概你们那边的需求是需要getIDL返回的生成message列表,以实现去重,是吧

@xiemalin
Copy link
Contributor

feature will add at 1.7.2

@xiemalin xiemalin added this to the 1.7.3 milestone Jun 15, 2015
@beykery
Copy link
Author

beykery commented Jun 15, 2015

是的,就是message去重。

@jhunters
Copy link
Owner

fixed at 1.7.3

/**
 * get IDL content from class.
 * 
 * @param cls target class to parse for IDL message.
 * @param cachedTypes if type already in set will not generate IDL. if a new type found will add to set
 * @param cachedEnumTypes if enum already in set will not generate IDL. if a new enum found will add to set
 * @return protobuf IDL content in string
 * @see Protobuf
 */
public static String getIDL(final Class<?> cls, final Set<Class<?>> cachedTypes, 
        final Set<Class<?>> cachedEnumTypes) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants