@Override public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase; // Servers can be created without an image so test if an image object is returned if (jsonElement.getAsJsonObject().get("image").isJsonObject()) { serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); } else { serverBase = apply((ServerInternalWithoutImage) context.deserialize(jsonElement, ServerInternalWithoutImage.class)); } Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }
.extendedAttributes( ServerExtendedAttributes.builder() .instanceName("instance-0000000b") .hostName("rdohavana.localdomain") .hypervisorHostName("rdohavana.localdomain").build() ).build(), Server.builder() .extendedAttributes( ServerExtendedAttributes.builder() .instanceName("instance-00000009") .hostName("rdohavana.localdomain") .hypervisorHostName("rdohavana.localdomain").build() .extendedAttributes( ServerExtendedAttributes.builder() .instanceName("instance-00000006").build() .extendedAttributes( ServerExtendedAttributes.builder() .instanceName("instance-00000005") .hostName("rdohavana.localdomain") .hypervisorHostName("rdohavana.localdomain").build() .extendedAttributes( ServerExtendedAttributes.builder() .instanceName("instance-00000004") .hostName("rdohavana.localdomain") .hypervisorHostName("rdohavana.localdomain").build()
.diskConfig("MANUAL") .extendedStatus(ServerExtendedStatus.builder().vmState("paused").powerState(3).build()) .extendedAttributes(ServerExtendedAttributes.builder().instanceName("instance-00000014").hostName("ubuntu").build()) .build();
.diskConfig("MANUAL") .extendedStatus(ServerExtendedStatus.builder().vmState("paused").powerState(3).build()) .extendedAttributes(ServerExtendedAttributes.builder().instanceName("instance-00000014").hostName("ubuntu").build()) .build();
@Override public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase; // Servers can be created without an image so test if an image object is returned if (jsonElement.getAsJsonObject().get("image").isJsonObject()) { serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); } else { serverBase = apply((ServerInternalWithoutImage) context.deserialize(jsonElement, ServerInternalWithoutImage.class)); } Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }
@Override public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase; // Servers can be created without an image so test if an image object is returned if (jsonElement.getAsJsonObject().get("image").isJsonObject()) { serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); } else { serverBase = apply((ServerInternalWithoutImage) context.deserialize(jsonElement, ServerInternalWithoutImage.class)); } Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }
@Override public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }
@Override public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }
@Override public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }
/** * @see ServerExtendedAttributes#getHostName() */ public Builder hostName(String hostName) { this.hostName = hostName; return self(); }
/** * @see ServerExtendedAttributes#getInstanceName() */ public Builder instanceName(String instanceName) { this.instanceName = instanceName; return self(); }
/** * @see ServerExtendedAttributes#getHostName() */ public T hostName(String hostName) { this.hostName = hostName; return self(); }
public Builder fromServerExtendedAttributes(ServerExtendedAttributes in) { return this .instanceName(in.getInstanceName()) .hostName(in.getHostName()) .hypervisorHostName(in.getHypervisorHostName()); }
/** * @see ServerExtendedAttributes#getHypervisorHostName() */ public T hypervisorHostName(String hypervisorHostName) { this.hypervisorHostName = hypervisorHostName; return self(); }
/** * @see ServerExtendedAttributes#getHypervisorHostName() */ public Builder hypervisorHostName(String hypervisorHostName) { this.hypervisorHostName = hypervisorHostName; return self(); }
/** * @see ServerExtendedAttributes#getHypervisorHostName() */ public Builder hypervisorHostName(String hypervisorHostName) { this.hypervisorHostName = hypervisorHostName; return self(); }
/** * @see ServerExtendedAttributes#getInstanceName() */ public Builder instanceName(String instanceName) { this.instanceName = instanceName; return self(); }
/** * @see ServerExtendedAttributes#getHostName() */ public Builder hostName(String hostName) { this.hostName = hostName; return self(); }
/** * @see ServerExtendedAttributes#getInstanceName() */ public T instanceName(String instanceName) { this.instanceName = instanceName; return self(); }
/** * @see ServerExtendedAttributes#getHostName() */ public T hostName(String hostName) { this.hostName = hostName; return self(); }