All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.norberg.automatter.example.NullableFoobarBuilder Maven / Gradle / Ivy

package io.norberg.automatter.example;

import io.norberg.automatter.AutoMatter;
import javax.annotation.Generated;

@Generated("io.norberg.automatter.processor.AutoMatterProcessor")
final class NullableFoobarBuilder {
  private String foo;

  private int bar;

  public NullableFoobarBuilder() {
  }

  private NullableFoobarBuilder(NullableExample.NullableFoobar v) {
    this.foo = v.foo();
    this.bar = v.bar();
  }

  private NullableFoobarBuilder(NullableFoobarBuilder v) {
    this.foo = v.foo;
    this.bar = v.bar;
  }

  public String foo() {
    return foo;
  }

  public NullableFoobarBuilder foo(String foo) {
    this.foo = foo;
    return this;
  }

  public int bar() {
    return bar;
  }

  public NullableFoobarBuilder bar(int bar) {
    this.bar = bar;
    return this;
  }

  public NullableExample.NullableFoobar build() {
    return new Value(foo, bar);
  }

  public static NullableFoobarBuilder from(NullableExample.NullableFoobar v) {
    return new NullableFoobarBuilder(v);
  }

  public static NullableFoobarBuilder from(NullableFoobarBuilder v) {
    return new NullableFoobarBuilder(v);
  }

  private static final class Value implements NullableExample.NullableFoobar {
    private final String foo;

    private final int bar;

    private Value(@AutoMatter.Field("foo") String foo, @AutoMatter.Field("bar") int bar) {
      this.foo = foo;
      this.bar = bar;
    }

    @AutoMatter.Field
    @Override
    public String foo() {
      return foo;
    }

    @AutoMatter.Field
    @Override
    public int bar() {
      return bar;
    }

    public NullableFoobarBuilder builder() {
      return new NullableFoobarBuilder(this);
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof NullableExample.NullableFoobar)) {
        return false;
      }
      final NullableExample.NullableFoobar that = (NullableExample.NullableFoobar) o;
      if (foo != null ? !foo.equals(that.foo()) : that.foo() != null) {
        return false;
      }
      if (bar != that.bar()) {
        return false;
      }
      return true;
    }

    @Override
    public int hashCode() {
      int result = 1;
      long temp;
      result = 31 * result + (foo != null ? foo.hashCode() : 0);
      result = 31 * result + bar;
      return result;
    }

    @Override
    public String toString() {
      return "NullableExample.NullableFoobar{" +
      "foo=" + foo +
      ", bar=" + bar +
      '}';
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy