Brian,

It will be helpful. I'm in the favor of it.


*Thanks,Kalyan Kumar Kalvagadda* | Software Engineer
t. (469) 279- <0000000000>5732
cloudera.com <https://www.cloudera.com>

[image: Cloudera] <https://www.cloudera.com/>

[image: Cloudera on Twitter] <https://twitter.com/cloudera> [image:
Cloudera on Facebook] <https://www.facebook.com/cloudera> [image: Cloudera
on LinkedIn] <https://www.linkedin.com/company/cloudera>
------------------------------

On Thu, May 24, 2018 at 2:54 PM, Brian Towles <btow...@cloudera.com> wrote:

> Howdy all,
>
> I was wondering what the teams thoughts are on using Lombok?
>
> https://projectlombok.org/
>
> Lombok is a tool that uses annotations at *compile time* to dynamically
> generate the boilerplate code for things like getters, setters, basic
> constructors, toString, equals, etc...
> There are no actual code changes to the source, so its not a traditional
> generator.  It uses the internal
> To me it has been a very helpful time saver for coding and maintenance and
> it allows for us to avoid missing things.
>
> A good look at how it works in IntelliJ and Eclipse is here:
> https://www.javacodegeeks.com/2016/06/lombok-compile-time-
> java-annotation-preprocessor-minimize-code-size.html
>
> But as a quick example of using this for a very simple class and a single
> @Data annotation takes:
>
> package org.apache.sentry;
>
> import lombok.Data;
>
> @Data
> public class SimpleBean {
>   private final String name;
>   private int age;
>   private double score;
>   private String[] tags;
> }
>
> and turn it effectively into
>
> package org.apache.sentry;
>
> public class SimpleBean {
>   private final String name;
>   private int age;
>   private double score;
>   private String[] tags;
>
>   @java.beans.ConstructorProperties({"name"})
>   public SimpleBean(String name) {
>     this.name = name;
>   }
>
>   public String getName() {
>     return this.name;
>   }
>
>   public int getAge() {
>     return this.age;
>   }
>
>   public double getScore() {
>     return this.score;
>   }
>
>   public String[] getTags() {
>     return this.tags;
>   }
>
>   public void setAge(int age) {
>     this.age = age;
>   }
>
>   public void setScore(double score) {
>     this.score = score;
>   }
>
>   public void setTags(String[] tags) {
>     this.tags = tags;
>   }
>
>   public boolean equals(Object o) {
>     if (o == this) {
>       return true;
>     }
>     if (!(o instanceof SimpleBean)) {
>       return false;
>     }
>     final SimpleBean other = (SimpleBean) o;
>     if (!other.canEqual((Object) this)) {
>       return false;
>     }
>     final Object this$name = this.getName();
>     final Object other$name = other.getName();
>     if (this$name == null ? other$name != null :
> !this$name.equals(other$name)) {
>       return false;
>     }
>     if (this.getAge() != other.getAge()) {
>       return false;
>     }
>     if (Double.compare(this.getScore(), other.getScore()) != 0) {
>       return false;
>     }
>     if (!java.util.Arrays.deepEquals(this.getTags(), other.getTags())) {
>       return false;
>     }
>     return true;
>   }
>
>   public int hashCode() {
>     final int PRIME = 59;
>     int result = 1;
>     final Object $name = this.getName();
>     result = result * PRIME + ($name == null ? 43 : $name.hashCode());
>     result = result * PRIME + this.getAge();
>     final long $score = Double.doubleToLongBits(this.getScore());
>     result = result * PRIME + (int) ($score >>> 32 ^ $score);
>     result = result * PRIME + java.util.Arrays.deepHashCode(
> this.getTags());
>     return result;
>   }
>
>   protected boolean canEqual(Object other) {
>     return other instanceof SimpleBean;
>   }
>
>   public String toString() {
>     return "SimpleBean(name=" + this.getName() + ", age=" +
> this.getAge() + ", score=" + this
>         .getScore() + ", tags=" +
> java.util.Arrays.deepToString(this.getTags()) + ")";
>   }
> }
>
>
> There are more helper functions in the library for things like Builders,
> and Synchronized.
>
> What do you guys think about using this in Sentry?
>
> -=Brian
>
> --
> *Brian Towles* | Software Engineer
> t. (512) 415- <0000000000>8105 e. btow...@cloudera.com <j...@cloudera.com>
> cloudera.com <http://www.cloudera.com/>
>
> [image: Cloudera] <http://www.cloudera.com/>
>
> [image: Cloudera on Twitter] <https://twitter.com/cloudera> [image:
> Cloudera on Facebook] <https://www.facebook.com/cloudera> [image: Cloudera
> on LinkedIn] <https://www.linkedin.com/company/cloudera>
> ------------------------------
>

Reply via email to