| 64 | public Request apply(RequestTemplate input); |
| 65 | |
| 66 | public static class HardCodedTarget<T> implements Target<T> { |
| 67 | |
| 68 | private final Class<T> type; |
| 69 | private final String name; |
| 70 | private final String url; |
| 71 | |
| 72 | public HardCodedTarget(Class<T> type, String url) { |
| 73 | this(type, url, url); |
| 74 | } |
| 75 | |
| 76 | public HardCodedTarget(Class<T> type, String name, String url) { |
| 77 | this.type = checkNotNull(type, "type"); |
| 78 | this.name = checkNotNull(emptyToNull(name), "name"); |
| 79 | this.url = checkNotNull(emptyToNull(url), "url"); |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public Class<T> type() { |
| 84 | return type; |
| 85 | } |
| 86 | |
| 87 | @Override |
| 88 | public String name() { |
| 89 | return name; |
| 90 | } |
| 91 | |
| 92 | @Override |
| 93 | public String url() { |
| 94 | return url; |
| 95 | } |
| 96 | |
| 97 | /* no authentication or other special activity. just insert the url. */ |
| 98 | @Override |
| 99 | public Request apply(RequestTemplate input) { |
| 100 | if (input.url().indexOf("http") != 0) { |
| 101 | input.target(url()); |
| 102 | } |
| 103 | return input.request(); |
| 104 | } |
| 105 | |
| 106 | @Override |
| 107 | public boolean equals(Object obj) { |
| 108 | if (obj instanceof HardCodedTarget) { |
| 109 | HardCodedTarget<?> other = (HardCodedTarget) obj; |
| 110 | return type.equals(other.type) && name.equals(other.name) && url.equals(other.url); |
| 111 | } |
| 112 | return false; |
| 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public int hashCode() { |
| 117 | int result = 17; |
| 118 | result = 31 * result + type.hashCode(); |
| 119 | result = 31 * result + name.hashCode(); |
| 120 | result = 31 * result + url.hashCode(); |
| 121 | return result; |
| 122 | } |
| 123 |
nothing calls this directly
no outgoing calls
no test coverage detected