コード例 #1
0
 @Test
 public void equals_different_ANNOTATIONS() {
   final Attribute a =
       new Blueprint().annotations(Lists.newArrayList(Annotation.of(Nonnull.class))).build();
   final Attribute b =
       new Blueprint().annotations(Lists.newArrayList(Annotation.of(Nullable.class))).build();
   assertFalse(a.equals(b));
   assertFalse(a.hashCode() == b.hashCode());
 }
コード例 #2
0
  private static final class Blueprint {

    private List<Annotation> annotations = Lists.newArrayList();

    private Final final1 = Final.UNDEFINED;

    private String name = "attribute";

    private Type type = Type.BOOLEAN;

    public Blueprint() {
      // default constructor
    }

    public Blueprint annotations(final List<Annotation> annotations) {
      this.annotations = annotations;
      return this;
    }

    @Nonnull
    public Attribute build() {
      return new Attribute(name, type, final1, annotations);
    }

    public Blueprint final1(final Final final1) {
      this.final1 = final1;
      return this;
    }

    public Blueprint name(final String name) {
      this.name = name;
      return this;
    }

    public Blueprint type(final Type type) {
      this.type = type;
      return this;
    }
  }