public ProtobufExtensionLookup add(Class<?> parent) {
// find all the generated service extensions for the class specified
for (Field field : parent.getFields()) {
// skip anything that isn't a generated extension. should be fine as long as we dont start
// mucking around with class loaders
if (field.getType() != GeneratedMessage.GeneratedExtension.class) {
continue;
}
try {
GeneratedMessage.GeneratedExtension extension =
(GeneratedMessage.GeneratedExtension) field.get(parent);
Message defaultMessageInst = extension.getMessageDefaultInstance();
this.fields.put(defaultMessageInst.getClass(), extension);
} catch (IllegalAccessException e) {
LOG.warn("Could not not access " + field + " for " + parent);
}
}
return this;
}
ProtobufExtensionLookup.java 文件源码
java
阅读 32
收藏 0
点赞 0
评论 0
项目:coyote
作者:
评论列表
文章目录