com.oracle.bmc.ailanguage.model.Entity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oci-java-sdk-ailanguage Show documentation
Show all versions of oci-java-sdk-ailanguage Show documentation
This project contains the SDK used for Oracle Cloud Infrastructure Ai Language
/**
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
*/
package com.oracle.bmc.ailanguage.model;
/**
* entity object
* Note: Objects should always be created or deserialized using the {@link Builder}. This model
* distinguishes fields that are {@code null} because they are unset from fields that are explicitly
* set to {@code null}. This is done in the setter methods of the {@link Builder}, which maintain a
* set of all explicitly set fields called {@link Builder#__explicitlySet__}. The {@link
* #hashCode()} and {@link #equals(Object)} methods are implemented to take the explicitly set
* fields into account. The constructor, on the other hand, does not take the explicitly set fields
* into account (since the constructor cannot distinguish explicit {@code null} from unset {@code
* null}).
*/
@jakarta.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20221001")
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = Entity.Builder.class)
@com.fasterxml.jackson.annotation.JsonFilter(
com.oracle.bmc.http.client.internal.ExplicitlySetBmcModel.EXPLICITLY_SET_FILTER_NAME)
public final class Entity extends com.oracle.bmc.http.client.internal.ExplicitlySetBmcModel {
@Deprecated
@java.beans.ConstructorProperties({"offset", "length", "text", "type", "isPii", "score"})
public Entity(
Integer offset, Integer length, String text, String type, Boolean isPii, Double score) {
super();
this.offset = offset;
this.length = length;
this.text = text;
this.type = type;
this.isPii = isPii;
this.score = score;
}
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "")
public static class Builder {
/** The number of Unicode code points preceding this entity in the submitted text. */
@com.fasterxml.jackson.annotation.JsonProperty("offset")
private Integer offset;
/**
* The number of Unicode code points preceding this entity in the submitted text.
*
* @param offset the value to set
* @return this builder
*/
public Builder offset(Integer offset) {
this.offset = offset;
this.__explicitlySet__.add("offset");
return this;
}
/** Length of entity text */
@com.fasterxml.jackson.annotation.JsonProperty("length")
private Integer length;
/**
* Length of entity text
*
* @param length the value to set
* @return this builder
*/
public Builder length(Integer length) {
this.length = length;
this.__explicitlySet__.add("length");
return this;
}
/** Entity text like name of person, location, and so on. */
@com.fasterxml.jackson.annotation.JsonProperty("text")
private String text;
/**
* Entity text like name of person, location, and so on.
*
* @param text the value to set
* @return this builder
*/
public Builder text(String text) {
this.text = text;
this.__explicitlySet__.add("text");
return this;
}
/** Type of entity text like PER, LOC, GPE and NOPE. */
@com.fasterxml.jackson.annotation.JsonProperty("type")
private String type;
/**
* Type of entity text like PER, LOC, GPE and NOPE.
*
* @param type the value to set
* @return this builder
*/
public Builder type(String type) {
this.type = type;
this.__explicitlySet__.add("type");
return this;
}
/** This flag is to indicate if it is PII entity or not. */
@com.fasterxml.jackson.annotation.JsonProperty("isPii")
private Boolean isPii;
/**
* This flag is to indicate if it is PII entity or not.
*
* @param isPii the value to set
* @return this builder
*/
public Builder isPii(Boolean isPii) {
this.isPii = isPii;
this.__explicitlySet__.add("isPii");
return this;
}
/** Score or confidence of extracted entity type. Example: {@code 0.9999856066867399} */
@com.fasterxml.jackson.annotation.JsonProperty("score")
private Double score;
/**
* Score or confidence of extracted entity type. Example: {@code 0.9999856066867399}
*
* @param score the value to set
* @return this builder
*/
public Builder score(Double score) {
this.score = score;
this.__explicitlySet__.add("score");
return this;
}
@com.fasterxml.jackson.annotation.JsonIgnore
private final java.util.Set __explicitlySet__ = new java.util.HashSet();
public Entity build() {
Entity model =
new Entity(
this.offset, this.length, this.text, this.type, this.isPii, this.score);
for (String explicitlySetProperty : this.__explicitlySet__) {
model.markPropertyAsExplicitlySet(explicitlySetProperty);
}
return model;
}
@com.fasterxml.jackson.annotation.JsonIgnore
public Builder copy(Entity model) {
if (model.wasPropertyExplicitlySet("offset")) {
this.offset(model.getOffset());
}
if (model.wasPropertyExplicitlySet("length")) {
this.length(model.getLength());
}
if (model.wasPropertyExplicitlySet("text")) {
this.text(model.getText());
}
if (model.wasPropertyExplicitlySet("type")) {
this.type(model.getType());
}
if (model.wasPropertyExplicitlySet("isPii")) {
this.isPii(model.getIsPii());
}
if (model.wasPropertyExplicitlySet("score")) {
this.score(model.getScore());
}
return this;
}
}
/** Create a new builder. */
public static Builder builder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder().copy(this);
}
/** The number of Unicode code points preceding this entity in the submitted text. */
@com.fasterxml.jackson.annotation.JsonProperty("offset")
private final Integer offset;
/**
* The number of Unicode code points preceding this entity in the submitted text.
*
* @return the value
*/
public Integer getOffset() {
return offset;
}
/** Length of entity text */
@com.fasterxml.jackson.annotation.JsonProperty("length")
private final Integer length;
/**
* Length of entity text
*
* @return the value
*/
public Integer getLength() {
return length;
}
/** Entity text like name of person, location, and so on. */
@com.fasterxml.jackson.annotation.JsonProperty("text")
private final String text;
/**
* Entity text like name of person, location, and so on.
*
* @return the value
*/
public String getText() {
return text;
}
/** Type of entity text like PER, LOC, GPE and NOPE. */
@com.fasterxml.jackson.annotation.JsonProperty("type")
private final String type;
/**
* Type of entity text like PER, LOC, GPE and NOPE.
*
* @return the value
*/
public String getType() {
return type;
}
/** This flag is to indicate if it is PII entity or not. */
@com.fasterxml.jackson.annotation.JsonProperty("isPii")
private final Boolean isPii;
/**
* This flag is to indicate if it is PII entity or not.
*
* @return the value
*/
public Boolean getIsPii() {
return isPii;
}
/** Score or confidence of extracted entity type. Example: {@code 0.9999856066867399} */
@com.fasterxml.jackson.annotation.JsonProperty("score")
private final Double score;
/**
* Score or confidence of extracted entity type. Example: {@code 0.9999856066867399}
*
* @return the value
*/
public Double getScore() {
return score;
}
@Override
public String toString() {
return this.toString(true);
}
/**
* Return a string representation of the object.
*
* @param includeByteArrayContents true to include the full contents of byte arrays
* @return string representation
*/
public String toString(boolean includeByteArrayContents) {
java.lang.StringBuilder sb = new java.lang.StringBuilder();
sb.append("Entity(");
sb.append("super=").append(super.toString());
sb.append("offset=").append(String.valueOf(this.offset));
sb.append(", length=").append(String.valueOf(this.length));
sb.append(", text=").append(String.valueOf(this.text));
sb.append(", type=").append(String.valueOf(this.type));
sb.append(", isPii=").append(String.valueOf(this.isPii));
sb.append(", score=").append(String.valueOf(this.score));
sb.append(")");
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Entity)) {
return false;
}
Entity other = (Entity) o;
return java.util.Objects.equals(this.offset, other.offset)
&& java.util.Objects.equals(this.length, other.length)
&& java.util.Objects.equals(this.text, other.text)
&& java.util.Objects.equals(this.type, other.type)
&& java.util.Objects.equals(this.isPii, other.isPii)
&& java.util.Objects.equals(this.score, other.score)
&& super.equals(other);
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = (result * PRIME) + (this.offset == null ? 43 : this.offset.hashCode());
result = (result * PRIME) + (this.length == null ? 43 : this.length.hashCode());
result = (result * PRIME) + (this.text == null ? 43 : this.text.hashCode());
result = (result * PRIME) + (this.type == null ? 43 : this.type.hashCode());
result = (result * PRIME) + (this.isPii == null ? 43 : this.isPii.hashCode());
result = (result * PRIME) + (this.score == null ? 43 : this.score.hashCode());
result = (result * PRIME) + super.hashCode();
return result;
}
}