Class FieldDescriptorCache
- java.lang.Object
-
- com.google.ads.googleads.lib.logging.scrub.FieldDescriptorCache
-
public class FieldDescriptorCache extends java.lang.ObjectCaches the results of looking up fields in a protobuf message's Descriptor.Empirical testing suggests that the first request for a message's descriptor is quite slow, for instance GoogleAdsRow takes about 0.5 seconds. Future requests to the protobuf descriptor API take around 3 usec. This cache reduces the ongoing lookup time to around 1 usec, but still suffers from the slow initial request performance.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FieldDescriptorCachegetDefault()Obtains a global instance of the cache.java.util.Optional<com.google.protobuf.Descriptors.FieldDescriptor>lookupField(java.lang.String fieldName, com.google.protobuf.MessageOrBuilder containingMessage)Retrieves a named field from a MessageOrBuilder.
-
-
-
Method Detail
-
getDefault
public static FieldDescriptorCache getDefault()
Obtains a global instance of the cache.
-
lookupField
public java.util.Optional<com.google.protobuf.Descriptors.FieldDescriptor> lookupField(java.lang.String fieldName, com.google.protobuf.MessageOrBuilder containingMessage)Retrieves a named field from a MessageOrBuilder. If the field is not in the cache then it is first populated and then returned.
-
-