Package org.apache.thrift.meta_data
Class FieldMetaData
java.lang.Object
org.apache.thrift.meta_data.FieldMetaData
- All Implemented Interfaces:
Serializable
This class is used to store meta data about thrift fields. Every field in a a struct should have
a corresponding instance of this class describing it.
The meta data is registered by ALL Thrift struct classes via a static {...} initializer block in the generated Thrift code.
Since different threads could be initializing different Thrift classes, calls to the public static methods of this class could be racy.
All methods of this class should be made thread safe.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFieldMetaData
(String name, byte req, FieldValueMetaData vMetaData) FieldMetaData
(String fieldName, byte requirementType, FieldValueMetaData valueMetaData, Map<String, String> fieldAnnotations) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends TBase<T,
F>, F extends TFieldIdEnum>
voidaddStructMetaDataMap
(Class<T> sClass, Map<F, FieldMetaData> map) static <T extends TBase<T,
F>, F extends TFieldIdEnum>
Map<F,FieldMetaData> getStructMetaDataMap
(Class<T> sClass) Returns a map with metadata (i.e. instances of FieldMetaData) that describe the fields of the given class.
-
Field Details
-
fieldName
-
requirementType
public final byte requirementType -
valueMetaData
-
-
Constructor Details
-
FieldMetaData
-
FieldMetaData
public FieldMetaData(String fieldName, byte requirementType, FieldValueMetaData valueMetaData, Map<String, String> fieldAnnotations)
-
-
Method Details
-
getFieldAnnotations
- Returns:
- an unmodifiable view of the annotations for this field, empty if no annotations present or code gen param is not turned on
-
addStructMetaDataMap
public static <T extends TBase<T,F>, void addStructMetaDataMapF extends TFieldIdEnum> (Class<T> sClass, Map<F, FieldMetaData> map) -
getStructMetaDataMap
public static <T extends TBase<T,F>, Map<F,F extends TFieldIdEnum> FieldMetaData> getStructMetaDataMap(Class<T> sClass) Returns a map with metadata (i.e. instances of FieldMetaData) that describe the fields of the given class.- Parameters:
sClass
- The TBase class for which the metadata map is requested. It is not guaranteed that sClass will have been statically initialized before this method is called. A racy call toaddStructMetaDataMap(Class, Map)
from a different thread during static initialization of the Thrift class is possible.
-