Class AttributeBuilderReflection.ThirdPartyAttributeBuilderStrategy

    • Constructor Detail

      • ThirdPartyAttributeBuilderStrategy

        ThirdPartyAttributeBuilderStrategy()
    • Method Detail

      • builderModel

        @Nullable
        @Parameter
        protected abstract AttributeBuilderThirdPartyModel builderModel()
        Guaranteed not null if isAttributeBuilder is true.
        Returns:
        model of how to generate attributeBuilder.
      • attributeValueType

        @Nullable
        @Parameter
        protected abstract javax.lang.model.element.TypeElement attributeValueType()
        Guaranteed not null if isAttributeBuilder is true.
        Returns:
        containingType of the value attribute.
      • isPossibleBuildMethod

        private static boolean isPossibleBuildMethod​(ValueAttribute attribute,
                                                     javax.lang.model.element.Element possibleBuildMethod)
        Returns true if there's a public way to build the value type with an instance no-arg method.
        Parameters:
        attribute - value attribute to check.
        possibleBuildMethod - method which matches StyleMirror.attributeBuilder()
        Returns:
        true if this is the possibleBuildMethod can build the value type.
      • isPossibleBuilderMethod

        private static boolean isPossibleBuilderMethod​(javax.lang.model.element.Element possibleBuilderMethod,
                                                       boolean onValueType,
                                                       ValueAttribute valueAttribute)
        Return true if the possibleBuilderMethod matches the Style#attributeBuilder() and returns a class. TODO: may need to make this return true if the return type is an interface too...
        Parameters:
        possibleBuilderMethod - executableElement
      • isPossibleBuilderClass

        private static boolean isPossibleBuilderClass​(javax.lang.model.element.Element possibleBuilderClass,
                                                      ValueAttribute valueAttribute)
        Determine if inner class could be a builder.
        Parameters:
        possibleBuilderClass - nested value element that could be builder class.
        Returns:
        true if it's a static inner class.
      • isPossibleCopyMethod

        protected static boolean isPossibleCopyMethod​(ValueAttribute valueAttribute,
                                                      javax.lang.model.element.Element possibleCopyMethod,
                                                      boolean onValueType)
        Applies to both builder and value candidates.
        Parameters:
        valueAttribute - the valueAttribute.
        possibleCopyMethod - candidate to check.