Class AutoValueSupport

    • Constructor Detail

      • AutoValueSupport

        public AutoValueSupport​(CalledMethodsAnnotatedTypeFactory atypeFactory)
        Create a new AutoValueSupport.
        Parameters:
        atypeFactory - the typechecker's type factory
    • Method Detail

      • handleConstructor

        public void handleConstructor​(com.sun.source.tree.NewClassTree tree,
                                      AnnotatedTypeMirror type)
        This method modifies the type of a copy constructor generated by AutoValue to match the type of the AutoValue toBuilder method, and has no effect if tree is a call to any other constructor.
        Specified by:
        handleConstructor in interface BuilderFrameworkSupport
        Parameters:
        tree - an AST for a constructor call
        type - type of the call expression
      • isBuilderBuildMethod

        public boolean isBuilderBuildMethod​(javax.lang.model.element.ExecutableElement candidateBuildElement)
        Description copied from interface: BuilderFrameworkSupport
        Returns true if a method is a build method on a Builder type for the builder framework.
        Specified by:
        isBuilderBuildMethod in interface BuilderFrameworkSupport
        Parameters:
        candidateBuildElement - a method
        Returns:
        true if candidateBuildElement is a build method on a Builder type for the builder framework
      • isToBuilderMethod

        public boolean isToBuilderMethod​(javax.lang.model.element.ExecutableElement candidateToBuilderElement)
        Description copied from interface: BuilderFrameworkSupport
        Returns true if a method is a toBuilder method on a type generated by the builder framework.
        Specified by:
        isToBuilderMethod in interface BuilderFrameworkSupport
        Parameters:
        candidateToBuilderElement - a method
        Returns:
        true if candidateToBuilderElement is a toBuilder method on a type generated by the builder framework
      • getAllAbstractMethods

        public java.util.List<javax.lang.model.element.ExecutableElement> getAllAbstractMethods​(javax.lang.model.element.TypeElement classElement)
        Get all the abstract methods for a class. This includes inherited abstract methods that are not overridden by the class or a superclass. There is no guarantee that this method will work as intended on code that implements an interface (which AutoValue classes are not supposed to do: https://github.com/google/auto/blob/master/value/userguide/howto.md#inherit).
        Parameters:
        classElement - the class
        Returns:
        list of all abstract methods