private GetTaskResponse(GetTaskResponse.Builder builder) { this.command = builder.command; this.diskInMb = builder.diskInMb; this.dropletId = builder.dropletId; this.memoryInMb = builder.memoryInMb; this.name = builder.name; this.result = builder.result; this.sequenceId = builder.sequenceId; this.state = builder.state; this.createdAt = builder.createdAt; this.id = builder.id; this.links = createUnmodifiableMap(false, false, builder.links); this.updatedAt = builder.updatedAt; }
/** * This instance is equal to all instances of {@code GetTaskResponse} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(Object another) { if (this == another) return true; return another instanceof GetTaskResponse && equalTo((GetTaskResponse) another); }
protected TaskStatus toTaskStatus(GetTaskResponse response) { switch (response.getState()) { case SUCCEEDED: return new TaskStatus(response.getId(), LaunchState.complete, null); case RUNNING: return new TaskStatus(response.getId(), LaunchState.running, null); case PENDING: return new TaskStatus(response.getId(), LaunchState.launching, null); case CANCELING: return new TaskStatus(response.getId(), LaunchState.cancelled, null); case FAILED: return new TaskStatus(response.getId(), LaunchState.failed, null); default: throw new IllegalStateException(String.format("Unsupported CF task state %s", response.getState())); } }
/** * Builds a new {@link GetTaskResponse GetTaskResponse}. * @return An immutable instance of GetTaskResponse * @throws java.lang.IllegalStateException if any required attributes are missing */ public GetTaskResponse build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new GetTaskResponse(this); }
@JsonCreator(mode = JsonCreator.Mode.DELEGATING) static GetTaskResponse fromJson(Json json) { GetTaskResponse.Builder builder = GetTaskResponse.builder(); if (json.command != null) { builder.command(json.command);