Class FieldDescriptorCache
java.lang.Object
com.google.ads.googleads.lib.logging.scrub.FieldDescriptorCache
Caches 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
Modifier and TypeMethodDescriptionstatic FieldDescriptorCacheObtains a global instance of the cache.Optional<com.google.protobuf.Descriptors.FieldDescriptor>lookupField(String fieldName, com.google.protobuf.MessageOrBuilder containingMessage) Retrieves a named field from a MessageOrBuilder.
-
Method Details
-
getDefault
Obtains a global instance of the cache. -
lookupField
public Optional<com.google.protobuf.Descriptors.FieldDescriptor> lookupField(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.
-