public static final Map < Field , ProtobufAttribute > getAllProtbufFields ( Class < ? extends Object > fromClazz ) { Map < Field , ProtobufAttribute > protoBufFields = CLASS_TO_FIELD_MAP_CACHE . get ( fromClazz . getCanonicalName ( ) ) ; if ( protoBufFields != null ) { return protoBufFields ; } else { protoBufFields = new HashMap <> ( ) ; } final List < Field > fields = JReflectionUtils . getAllFields ( new ArrayList < Field > ( ) , fromClazz ) ; for ( Field field : fields ) { final Annotation annotation = field . getAnnotation ( ProtobufAttribute . class ) ; if ( annotation == null ) { continue ; } final ProtobufAttribute gpbAnnotation = ( ProtobufAttribute ) annotation ; protoBufFields . put ( field , gpbAnnotation ) ; } // Caching to increase speed CLASS_TO_FIELD_MAP_CACHE . put ( fromClazz . getCanonicalName ( ) , protoBufFields ) ; return protoBufFields ; }
Returns a full mapping of all Protobuf fields from the POJO class . Essentially the only fields that will be returned if they have the ProtobufAttribute annotation .