.add("address", address).add("port", port).toString();
}
- /**
- * Utility type used to correctly read immutable object from JSON representation.
- *
- * @deprecated Do not use this type directly, it exists only for the <em>Jackson</em>-binding
- * infrastructure
- */
- @Deprecated
- @JsonDeserialize
- static final class Json extends Service {
- String id;
- String service;
- List<String> tags = ImmutableList.of();
- String address;
- Integer port;
-
- @JsonProperty(value = "ID")
- public void setId(String id) {
- this.id = id;
- }
-
- @JsonProperty(value = "Service")
- public void setService(String service) {
- this.service = service;
- }
-
- @JsonProperty(value = "Tags")
- @JsonDeserialize(as = ImmutableList.class, contentAs = String.class)
- public void setTags(List<String> tags) {
- this.tags = tags;
- }
-
- @JsonProperty(value = "Address")
- public void setAddress(String address) {
- this.address = address;
- }
-
- @JsonProperty(value = "Port")
- public void setPort(int port) {
- this.port = port;
- }
-
- @Override
- public String getId() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getService() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public List<String> getTags() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getAddress() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public int getPort() {
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * @param json A JSON-bindable data structure
- * @return An immutable value type
- * @deprecated Do not use this method directly, it exists only for the <em>Jackson</em>-binding
- * infrastructure
- */
- @Deprecated
- @JsonCreator
- static ImmutableService fromJson(Json json) {
- ImmutableService.Builder builder = ImmutableService.builder();
- if (json.id != null) {
- builder.id(json.id);
- }
- if (json.service != null) {
- builder.service(json.service);
- }
- if (json.tags != null) {
- builder.addAllTags(json.tags);
- }
- if (json.address != null) {
- builder.address(json.address);
- }
- if (json.port != null) {
- builder.port(json.port);
- }
- return builder.build();
- }
-
+
/**
* Creates an immutable copy of a {@link Service} value. Uses accessors to get values to
* initialize the new immutable instance. If an instance is already immutable, it is returned as