Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ private Builder(CreateDialogNode createDialogNode) {
/**
* Instantiates a new builder.
*/
public Builder() { }
public Builder() {
}

/**
* Builds the CreateDialogNode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.google.gson.annotations.SerializedName;
import com.ibm.watson.developer_cloud.service.model.GenericModel;
import com.ibm.watson.developer_cloud.util.Validator;

Expand All @@ -27,30 +29,49 @@ public class CreateEntity extends GenericModel {
private String entity;
/** The description of the entity. */
private String description;
/** Any metadata related to the value. */
private Map<String, Object> metadata;
/** An array of entity values. */
private List<CreateValue> values;
/** Whether to use fuzzy matching for the entity. */
@SerializedName("fuzzy_match")
private Boolean fuzzyMatch;

/**
* Builder.
*/
public static class Builder {
private String entity;
private String description;
private Map<String, Object> metadata;
private List<CreateValue> values;
private Boolean fuzzyMatch;

private Builder(CreateEntity createEntity) {
entity = createEntity.entity;
description = createEntity.description;
metadata = createEntity.metadata;
values = createEntity.values;
fuzzyMatch = createEntity.fuzzyMatch;
}

/**
* Instantiates a new builder.
*/
public Builder() { }
public Builder() {
}

/**
* Instantiates a new builder with required properties.
*
* @param entity the entity
*/
public Builder(String entity) {
this.entity = entity;
}

/**
* Builds the CreateEntity.
* Builds a CreateEntity.
*
* @return the createEntity
*/
Expand All @@ -59,24 +80,25 @@ public CreateEntity build() {
}

/**
* Adds an values to values.
* Adds an value to values.
*
* @param values the new values
* @return the builder
* @param value the new value
* @return the CreateEntity builder
*/
public Builder values(CreateValue values) {
public Builder values(CreateValue value) {
Validator.notNull(value, "value cannot be null");
if (this.values == null) {
this.values = new ArrayList<CreateValue>();
}
this.values.add(values);
this.values.add(value);
return this;
}

/**
* Set the entity.
*
* @param entity the entity
* @return a CreateEntity Builder
* @return the CreateEntity builder
*/
public Builder entity(String entity) {
this.entity = entity;
Expand All @@ -87,37 +109,61 @@ public Builder entity(String entity) {
* Set the description.
*
* @param description the description
* @return a CreateEntity Builder
* @return the CreateEntity builder
*/
public Builder description(String description) {
this.description = description;
return this;
}

/**
* Set the metadata.
*
* @param metadata the metadata
* @return the CreateEntity builder
*/
public Builder metadata(Map<String, Object> metadata) {
this.metadata = metadata;
return this;
}

/**
* Set the values.
* Existing values will be replaced.
*
* @param values the values
* @return a CreateEntity Builder
* @return the CreateEntity builder
*/
public Builder values(List<CreateValue> values) {
this.values = values;
return this;
}

/**
* Set the fuzzyMatch.
*
* @param fuzzyMatch the fuzzyMatch
* @return the CreateEntity builder
*/
public Builder fuzzyMatch(Boolean fuzzyMatch) {
this.fuzzyMatch = fuzzyMatch;
return this;
}
}

private CreateEntity(Builder builder) {
Validator.notNull(builder.entity, "entity cannot be null");
entity = builder.entity;
description = builder.description;
metadata = builder.metadata;
values = builder.values;
fuzzyMatch = builder.fuzzyMatch;
}

/**
* New builder.
*
* @return the builder
* @return a CreateEntity builder
*/
public Builder newBuilder() {
return new Builder(this);
Expand All @@ -141,6 +187,15 @@ public String description() {
return description;
}

/**
* Gets the metadata.
*
* @return the metadata
*/
public Map<String, Object> metadata() {
return metadata;
}

/**
* Gets the values.
*
Expand All @@ -149,4 +204,13 @@ public String description() {
public List<CreateValue> values() {
return values;
}

/**
* Gets the fuzzyMatch.
*
* @return the fuzzyMatch
*/
public Boolean fuzzyMatch() {
return fuzzyMatch;
}
}
Loading