com.basistech.rosette.apimodel.Name Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rosette-api-all Show documentation
Show all versions of rosette-api-all Show documentation
Babel Street Analytics API all modules combined
The newest version!
// Generated by delombok at Fri Nov 15 11:56:46 CST 2024
/*
* Copyright 2022 Basis Technology Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basistech.rosette.apimodel;
import com.basistech.util.ISO15924;
import com.basistech.util.LanguageCode;
import jakarta.validation.constraints.NotNull;
/**
* Class that represents a name.
*/
public final class Name {
/**
*/
@NotNull
private final String text;
/**
*/
private final String entityType;
/**
*/
private final ISO15924 script;
/**
*/
private final LanguageCode language;
/**
*/
private final Gender gender;
/**
* Default constructor for lombok (gender is optional)
*
* @param name
* @param entityType
* @param script
* @param language
*/
public Name(String name, String entityType, ISO15924 script, LanguageCode language) {
this.text = name;
this.entityType = entityType;
this.script = script;
this.language = language;
this.gender = null;
}
/**
* Default constructor for lombok with gender
*
* @param name
* @param entityType
* @param script
* @param language
* @param gender
*/
public Name(String name, String entityType, ISO15924 script, LanguageCode language, Gender gender) {
this.text = name;
this.entityType = entityType;
this.script = script;
this.language = language;
this.gender = gender;
}
/**
* Constructor for {@code Name} with default entityType PERSON, unknown script and unknown language
* This allows Jackson to use the single arg constructor to deserialize a short-hand value
* like {"name": "Mike"} instead of the full fledged {"name": {"text": "Mike"}}
* @param name a name
*/
public Name(String name) {
this.text = name;
this.entityType = "PERSON";
this.script = ISO15924.Zyyy;
this.language = LanguageCode.UNKNOWN;
this.gender = null;
}
@SuppressWarnings("all")
public static class NameBuilder {
@SuppressWarnings("all")
private String text;
@SuppressWarnings("all")
private String entityType;
@SuppressWarnings("all")
private ISO15924 script;
@SuppressWarnings("all")
private LanguageCode language;
@SuppressWarnings("all")
private Gender gender;
@SuppressWarnings("all")
NameBuilder() {
}
/**
* @return {@code this}.
*/
@SuppressWarnings("all")
public Name.NameBuilder text(final String text) {
this.text = text;
return this;
}
/**
* @return {@code this}.
*/
@SuppressWarnings("all")
public Name.NameBuilder entityType(final String entityType) {
this.entityType = entityType;
return this;
}
/**
* @return {@code this}.
*/
@SuppressWarnings("all")
public Name.NameBuilder script(final ISO15924 script) {
this.script = script;
return this;
}
/**
* @return {@code this}.
*/
@SuppressWarnings("all")
public Name.NameBuilder language(final LanguageCode language) {
this.language = language;
return this;
}
/**
* @return {@code this}.
*/
@SuppressWarnings("all")
public Name.NameBuilder gender(final Gender gender) {
this.gender = gender;
return this;
}
@SuppressWarnings("all")
public Name build() {
return new Name(this.text, this.entityType, this.script, this.language, this.gender);
}
@Override
@SuppressWarnings("all")
public String toString() {
return "Name.NameBuilder(text=" + this.text + ", entityType=" + this.entityType + ", script=" + this.script + ", language=" + this.language + ", gender=" + this.gender + ")";
}
}
@SuppressWarnings("all")
public static Name.NameBuilder builder() {
return new Name.NameBuilder();
}
/**
* @return text of the name
*/
@SuppressWarnings("all")
public String getText() {
return this.text;
}
/**
* @return entity type of the name
*/
@SuppressWarnings("all")
public String getEntityType() {
return this.entityType;
}
/**
* @return script of the name, {@link ISO15924}
*/
@SuppressWarnings("all")
public ISO15924 getScript() {
return this.script;
}
/**
* @return language of the name, {@link LanguageCode}
*/
@SuppressWarnings("all")
public LanguageCode getLanguage() {
return this.language;
}
/**
* @return gender of the name, {@link Gender}
*/
@SuppressWarnings("all")
public Gender getGender() {
return this.gender;
}
@Override
@SuppressWarnings("all")
public boolean equals(final Object o) {
if (o == this) return true;
if (!(o instanceof Name)) return false;
final Name other = (Name) o;
final Object this$text = this.getText();
final Object other$text = other.getText();
if (this$text == null ? other$text != null : !this$text.equals(other$text)) return false;
final Object this$entityType = this.getEntityType();
final Object other$entityType = other.getEntityType();
if (this$entityType == null ? other$entityType != null : !this$entityType.equals(other$entityType)) return false;
final Object this$script = this.getScript();
final Object other$script = other.getScript();
if (this$script == null ? other$script != null : !this$script.equals(other$script)) return false;
final Object this$language = this.getLanguage();
final Object other$language = other.getLanguage();
if (this$language == null ? other$language != null : !this$language.equals(other$language)) return false;
final Object this$gender = this.getGender();
final Object other$gender = other.getGender();
if (this$gender == null ? other$gender != null : !this$gender.equals(other$gender)) return false;
return true;
}
@Override
@SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $text = this.getText();
result = result * PRIME + ($text == null ? 43 : $text.hashCode());
final Object $entityType = this.getEntityType();
result = result * PRIME + ($entityType == null ? 43 : $entityType.hashCode());
final Object $script = this.getScript();
result = result * PRIME + ($script == null ? 43 : $script.hashCode());
final Object $language = this.getLanguage();
result = result * PRIME + ($language == null ? 43 : $language.hashCode());
final Object $gender = this.getGender();
result = result * PRIME + ($gender == null ? 43 : $gender.hashCode());
return result;
}
@Override
@SuppressWarnings("all")
public String toString() {
return "Name(text=" + this.getText() + ", entityType=" + this.getEntityType() + ", script=" + this.getScript() + ", language=" + this.getLanguage() + ", gender=" + this.getGender() + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy