/** * 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)); }
if (isCacheEnabled()) { Codec codec = CACHED.get(uniClsName); if (codec != null) {
try { Codec<FileDescriptorProtoPOJO> descriptorCodec = ProtobufProxy.create(FileDescriptorProtoPOJO.class, ProtobufProxy.isCacheEnabled(), ProtobufProxy.OUTPUT_PATH.get()); byte[] bs = descriptorCodec.encode(fileDescriptorProto); fileproto = FileDescriptorProto.parseFrom(bs);