/** * To generate a protobuf proxy java source code for target class. * * @param os to generate java source code * @param cls target class * @param charset charset type * @throws IOException in case of any io relative exception. */ public static void dynamicCodeGenerate(OutputStream os, Class cls, Charset charset) throws IOException { dynamicCodeGenerate(os, cls, charset, getCodeGenerator(cls)); }
/** * To create a protobuf proxy class for target class. * * @param <T> generic type * @param cls target class to parse <code>@Protobuf</code> annotation * @param compiler the compiler * @param codeGenerator the code generator * @return {@link Codec} instance proxy */ public static <T> Codec<T> create(Class<T> cls, Compiler compiler, ICodeGenerator codeGenerator) { return create(cls, isDebugEnabled(), null, compiler, getCodeGenerator(cls)); }
/** * To create a protobuf proxy class for target class. * * @param <T> target object type to be proxied. * @param cls target object class * @param debug true will print generate java source code * @param path the path * @return proxy instance object. */ public static <T> Codec<T> create(Class<T> cls, boolean debug, File path) { // to check cache early String uniClsName = cls.getName(); if (isCacheEnabled()) { Codec codec = CACHED.get(uniClsName); if (codec != null) { return codec; } } return create(cls, debug, path, null, getCodeGenerator(cls)); }