diff --git a/vision/text/pom.xml b/vision/text/pom.xml index c2bfa762b8c..54c5f7ad84b 100644 --- a/vision/text/pom.xml +++ b/vision/text/pom.xml @@ -50,12 +50,6 @@ guava 20.0 - - com.google.auto.value - auto-value - 1.3 - provided - org.apache.opennlp opennlp-tools diff --git a/vision/text/src/main/java/com/google/cloud/vision/samples/text/ImageText.java b/vision/text/src/main/java/com/google/cloud/vision/samples/text/ImageText.java index 0b4adb4d85e..4d695f9401f 100644 --- a/vision/text/src/main/java/com/google/cloud/vision/samples/text/ImageText.java +++ b/vision/text/src/main/java/com/google/cloud/vision/samples/text/ImageText.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. All Rights Reserved. + * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import com.google.api.services.vision.v1.model.EntityAnnotation; import com.google.api.services.vision.v1.model.Status; -import com.google.auto.value.AutoValue; import java.nio.file.Path; import java.util.List; @@ -28,28 +27,58 @@ /** * A data object for mapping text to file paths. */ -@AutoValue -abstract class ImageText { +public class ImageText { + private Path pth; + private List ts; + private Status err; public static Builder builder() { - return new AutoValue_ImageText.Builder(); + return new Builder(); } - public abstract Path path(); + private ImageText() {} - public abstract List textAnnotations(); + public Path path() { + return this.pth; + } + + public List textAnnotations() { + return this.ts; + } @Nullable - public abstract Status error(); + public Status error() { + return this.err; + } + + public static class Builder { + private Path pth; + private List ts; + private Status err; + + Builder() {} - @AutoValue.Builder - public abstract static class Builder { - public abstract Builder path(Path path); + public Builder path(Path path) { + this.pth = path; + return this; + } - public abstract Builder textAnnotations(List ts); + public Builder textAnnotations(List ts) { + this.ts = ts; + return this; + } - public abstract Builder error(@Nullable Status err); + public Builder error(@Nullable Status err) { + this.err = err; + return this; + } - public abstract ImageText build(); + public ImageText build() { + ImageText out = new ImageText(); + out.pth = this.pth; + out.ts = this.ts; + out.err = this.err; + return out; + } } } diff --git a/vision/text/src/main/java/com/google/cloud/vision/samples/text/Index.java b/vision/text/src/main/java/com/google/cloud/vision/samples/text/Index.java index 4c739a66dfd..080d4d31e3b 100644 --- a/vision/text/src/main/java/com/google/cloud/vision/samples/text/Index.java +++ b/vision/text/src/main/java/com/google/cloud/vision/samples/text/Index.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. All Rights Reserved. + * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/text/src/main/java/com/google/cloud/vision/samples/text/TextApp.java b/vision/text/src/main/java/com/google/cloud/vision/samples/text/TextApp.java index 1ca841069ef..951dacd00f6 100644 --- a/vision/text/src/main/java/com/google/cloud/vision/samples/text/TextApp.java +++ b/vision/text/src/main/java/com/google/cloud/vision/samples/text/TextApp.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. All Rights Reserved. + * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/text/src/main/java/com/google/cloud/vision/samples/text/Word.java b/vision/text/src/main/java/com/google/cloud/vision/samples/text/Word.java index 0dfb4f24ed0..546bb4ca23c 100644 --- a/vision/text/src/main/java/com/google/cloud/vision/samples/text/Word.java +++ b/vision/text/src/main/java/com/google/cloud/vision/samples/text/Word.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 Google Inc. All Rights Reserved. + * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,30 +16,65 @@ package com.google.cloud.vision.samples.text; -import com.google.auto.value.AutoValue; - import java.nio.file.Path; /** * A data object for mapping words to file paths. */ -@AutoValue -abstract class Word { +public class Word { + private Path pth; + private String wrd; public static Builder builder() { - return new AutoValue_Word.Builder(); + return new Builder(); + } + + public Path path() { + return this.pth; + } + + public String word() { + return this.wrd; + } + + @Override + public boolean equals(Object other) { + if (other == null) { + return false; + } + if (!(other instanceof Word)) { + return false; + } + Word otherWord = (Word) other; + return this.path().equals(otherWord.path()) && this.word().equals(otherWord.word()); + } + + @Override + public int hashCode() { + return this.word().hashCode() ^ this.path().hashCode(); } - public abstract Path path(); + public static class Builder { + private Path pth; + private String wrd; - public abstract String word(); + Builder() {} - @AutoValue.Builder - public abstract static class Builder { - public abstract Builder path(Path path); + public Builder path(Path path) { + this.pth = path; + return this; + } - public abstract Builder word(String word); + public Builder word(String word) { + this.wrd = word; + return this; + } - public abstract Word build(); + public Word build() { + Word out = new Word(); + out.pth = this.pth; + out.wrd = this.wrd; + return out; + } } }