|
1 | 1 | /*
|
2 |
| - * Copyright 2016 Google Inc. All Rights Reserved. |
| 2 | + * Copyright 2016 Google Inc. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
18 | 18 |
|
19 | 19 | import com.google.api.services.vision.v1.model.EntityAnnotation;
|
20 | 20 | import com.google.api.services.vision.v1.model.Status;
|
21 |
| -import com.google.auto.value.AutoValue; |
22 | 21 |
|
23 | 22 | import java.nio.file.Path;
|
24 | 23 | import java.util.List;
|
|
28 | 27 | /**
|
29 | 28 | * A data object for mapping text to file paths.
|
30 | 29 | */
|
31 |
| -@AutoValue |
32 |
| -abstract class ImageText { |
| 30 | +public class ImageText { |
| 31 | + private Path pth; |
| 32 | + private List<EntityAnnotation> ts; |
| 33 | + private Status err; |
33 | 34 |
|
34 | 35 | public static Builder builder() {
|
35 |
| - return new AutoValue_ImageText.Builder(); |
| 36 | + return new Builder(); |
36 | 37 | }
|
37 | 38 |
|
38 |
| - public abstract Path path(); |
| 39 | + private ImageText() {} |
39 | 40 |
|
40 |
| - public abstract List<EntityAnnotation> textAnnotations(); |
| 41 | + public Path path() { |
| 42 | + return this.pth; |
| 43 | + } |
| 44 | + |
| 45 | + public List<EntityAnnotation> textAnnotations() { |
| 46 | + return this.ts; |
| 47 | + } |
41 | 48 |
|
42 | 49 | @Nullable
|
43 |
| - public abstract Status error(); |
| 50 | + public Status error() { |
| 51 | + return this.err; |
| 52 | + } |
| 53 | + |
| 54 | + public static class Builder { |
| 55 | + private Path pth; |
| 56 | + private List<EntityAnnotation> ts; |
| 57 | + private Status err; |
| 58 | + |
| 59 | + Builder() {} |
44 | 60 |
|
45 |
| - @AutoValue.Builder |
46 |
| - public abstract static class Builder { |
47 |
| - public abstract Builder path(Path path); |
| 61 | + public Builder path(Path path) { |
| 62 | + this.pth = path; |
| 63 | + return this; |
| 64 | + } |
48 | 65 |
|
49 |
| - public abstract Builder textAnnotations(List<EntityAnnotation> ts); |
| 66 | + public Builder textAnnotations(List<EntityAnnotation> ts) { |
| 67 | + this.ts = ts; |
| 68 | + return this; |
| 69 | + } |
50 | 70 |
|
51 |
| - public abstract Builder error(@Nullable Status err); |
| 71 | + public Builder error(@Nullable Status err) { |
| 72 | + this.err = err; |
| 73 | + return this; |
| 74 | + } |
52 | 75 |
|
53 |
| - public abstract ImageText build(); |
| 76 | + public ImageText build() { |
| 77 | + ImageText out = new ImageText(); |
| 78 | + out.pth = this.pth; |
| 79 | + out.ts = this.ts; |
| 80 | + out.err = this.err; |
| 81 | + return out; |
| 82 | + } |
54 | 83 | }
|
55 | 84 | }
|
0 commit comments