Class AbstractThriftMetadataBuilder

java.lang.Object
io.airlift.drift.codec.metadata.AbstractThriftMetadataBuilder
Direct Known Subclasses:
ThriftStructMetadataBuilder, ThriftUnionMetadataBuilder

public abstract class AbstractThriftMetadataBuilder extends Object
  • Field Details

    • structName

      protected final String structName
    • structType

      protected final Type structType
    • builderType

      protected final Type builderType
    • documentation

      protected final List<String> documentation
    • fields

      protected final List<io.airlift.drift.codec.metadata.FieldMetadata> fields
    • extractors

      protected final List<io.airlift.drift.codec.metadata.Extractor> extractors
    • builderMethodInjections

      protected final List<io.airlift.drift.codec.metadata.MethodInjection> builderMethodInjections
    • constructorInjections

      protected final List<io.airlift.drift.codec.metadata.ConstructorInjection> constructorInjections
    • fieldInjections

      protected final List<io.airlift.drift.codec.metadata.FieldInjection> fieldInjections
    • methodInjections

      protected final List<io.airlift.drift.codec.metadata.MethodInjection> methodInjections
    • catalog

      protected final ThriftCatalog catalog
    • metadataErrors

      protected final MetadataErrors metadataErrors
  • Constructor Details

    • AbstractThriftMetadataBuilder

      protected AbstractThriftMetadataBuilder(ThriftCatalog catalog, Type structType)
  • Method Details

    • extractName

      protected abstract String extractName()
    • extractStructIdlAnnotations

      protected abstract Map<String,String> extractStructIdlAnnotations()
    • extractBuilderClass

      protected abstract Class<?> extractBuilderClass()
    • validateConstructors

      protected abstract void validateConstructors()
    • isValidateSetter

      protected abstract boolean isValidateSetter(Method method)
    • buildField

      protected abstract ThriftFieldMetadata buildField(Collection<io.airlift.drift.codec.metadata.FieldMetadata> input)
    • build

      public abstract ThriftStructMetadata build()
    • getMetadataErrors

      public MetadataErrors getMetadataErrors()
    • getStructClass

      public Class<?> getStructClass()
    • getBuilderClass

      public Class<?> getBuilderClass()
    • verifyClass

      protected final void verifyClass(Class<? extends Annotation> annotation)
    • extractFromConstructors

      protected final void extractFromConstructors()
    • addConstructors

      protected final void addConstructors(Type type)
    • addBuilderMethods

      protected final void addBuilderMethods()
    • extractFromFields

      protected final void extractFromFields()
    • addFields

      protected final void addFields(Class<?> clazz, boolean allowReaders, boolean allowWriters)
    • addField

      protected final void addField(Field fieldField, boolean allowReaders, boolean allowWriters)
    • extractFromMethods

      protected final void extractFromMethods()
    • addMethods

      protected final void addMethods(Type type, boolean allowReaders, boolean allowWriters)
    • addMethod

      protected final void addMethod(Type type, Method method, boolean allowReaders, boolean allowWriters)
    • hasThriftFieldAnnotation

      protected final boolean hasThriftFieldAnnotation(Method method)
    • isValidateGetter

      protected final boolean isValidateGetter(Method method)
    • getParameterInjections

      protected final List<io.airlift.drift.codec.metadata.ParameterInjection> getParameterInjections(Type type, Annotation[][] parameterAnnotations, Type[] parameterTypes, List<String> parameterNames)
    • normalizeThriftFields

      protected final void normalizeThriftFields(ThriftCatalog catalog)
    • inferThriftFieldIds

      protected final Set<String> inferThriftFieldIds()
      Assigns all fields an id if possible. Fields are grouped by name and for each group, if there is a single id, all fields in the group are assigned this id. If the group has multiple ids, an error is reported.
    • inferThriftFieldIds

      protected final void inferThriftFieldIds(com.google.common.collect.Multimap<String,io.airlift.drift.codec.metadata.FieldMetadata> fieldsByName, Set<String> fieldsWithConflictingIds)
    • extractFieldIdlAnnotations

      protected final Map<String,String> extractFieldIdlAnnotations(short fieldId, Collection<io.airlift.drift.codec.metadata.FieldMetadata> fields)
    • extractFieldIsRecursiveReference

      protected final boolean extractFieldIsRecursiveReference(short fieldId, Collection<io.airlift.drift.codec.metadata.FieldMetadata> fields)
    • extractFieldIsLegacyId

      protected final boolean extractFieldIsLegacyId(short id, String fieldName, Collection<io.airlift.drift.codec.metadata.FieldMetadata> fields)
    • extractFieldName

      protected final String extractFieldName(short id, Collection<io.airlift.drift.codec.metadata.FieldMetadata> fields)
    • extractFieldRequiredness

      protected final ThriftField.Requiredness extractFieldRequiredness(short fieldId, String fieldName, Collection<io.airlift.drift.codec.metadata.FieldMetadata> fields)
    • verifyFieldType

      protected final void verifyFieldType(short id, String name, Collection<io.airlift.drift.codec.metadata.FieldMetadata> fields, ThriftCatalog catalog)
      Verifies that the the fields all have a supported Java type and that all fields map to the exact same ThriftType.
    • buildBuilderConstructorInjections

      protected final ThriftMethodInjection buildBuilderConstructorInjections()
    • buildFieldInjections

      protected final Iterable<ThriftFieldMetadata> buildFieldInjections()
    • buildMethodInjections

      protected final List<ThriftMethodInjection> buildMethodInjections()
    • buildParameterInjections

      protected static List<ThriftParameterInjection> buildParameterInjections(List<io.airlift.drift.codec.metadata.ParameterInjection> parameters)