auto (google/auto)
Searching Database…
What is this?
Auto is a collection of source code generators for Java that automatically produce the mechanical, repetitive boilerplate code developers would otherwise write by hand.
Is this one library or a bundle of separate tools?
It is an umbrella collection bundling four distinct annotation-processor subprojects: AutoFactory, AutoService, AutoValue, and Common, each solving a different code-generation problem.
How do I start using one of these generators?
You add the specific subproject you need (AutoFactory, AutoService, or AutoValue) as a dependency to your Java build and annotate your classes; the annotation processor then generates the supporting code at compile time.
Do I need a specific Java version for these?
AutoValue requires Java 8 or newer; the other subprojects work with standard Java annotation processing during compilation, no extra runtime is needed.
Do I need to pick the right subproject for my use case?
Yes, there is no single do-it-all generator: AutoFactory, AutoService, AutoValue, and Common each target a different, specific problem, so you choose the one that matches what you're building.
What does AutoValue actually generate?
AutoValue generates the boilerplate for immutable value-type classes in Java 8+, such as constructors, equals, hashCode, and toString, from a simple abstract class you write.
What is AutoFactory for?
AutoFactory generates JSR-330-compatible factory classes, removing the need to hand-write factory boilerplate for dependency-injected objects.
What problem does AutoService solve?
AutoService generates the provider-configuration files Java's ServiceLoader mechanism needs, so you don't have to maintain them by hand.
Why did Google build this instead of writing the code manually?
Repetitive Java boilerplate is mechanical, often untested, and a frequent source of subtle bugs, so Auto's generators produce that code automatically and correctly.
What are similar projects?
lombok, butterknife, gson, javapoet, grumpy, closure-compiler, wire, hutool
Which topics is it in?
java-library, codegen, software-engineering, coding, jvm, design-patterns, boilerplate, code-generation, google, programming, compiler, utility