org.erasmusmc.data_mining.ontology.common.Label Maven / Gradle / Ivy
The newest version!
/**
* Peregrine is an indexing engine that can recognize concepts in human readable
* text, based on a database (thesaurus) of known terms.
*
* Copyright 2005-2011 Erasmus University Medical Centre (EMC)
* Copyright 2009-2011 Netherlands Bioinformatics Centre (NBIC)
*
* Contact us at: [email protected]
*
* This file is part of Peregrine. Peregrine is free software: you can
* redistribute it and/or modify it under the terms of the GNU Affero General
* Public License as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package org.erasmusmc.data_mining.ontology.common;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
/**
* The language-dependent text.
*
*
* Java class for label complex type.
*
*
* The following schema fragment specifies the expected content contained within
* this class.
*
*
* <complexType name="label">
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>string">
* <attribute ref="{http://www.w3.org/XML/1998/namespace}lang
* use="required""/>
* </extension>
* </simpleContent>
* </complexType>
*
*
* @deprecated Use org.erasmusmc.data_mining.ontology.common.LabelImpl instead.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "label", propOrder = { "text" })
public final class Label {
/**
* The text of this label.
*/
@XmlValue
private String text;
/**
* The language of the text of this label as an ISO 639-1 code.
*/
@XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace",
required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "language")
private String lang;
/**
* Default no-arg constructor.
*
*/
public Label() {
super();
}
/**
* Fully-initialising value constructor.
*
* @param labelText the text of this label.
* @param languageCode the language of this label.
*/
public Label(final String labelText, final String languageCode) {
this.text = labelText;
this.lang = languageCode;
}
/**
* Gets the value of the text property.
*
* @return possible object is {@link String }
*
*/
public String getText() {
return text;
}
/**
* Sets the value of the text property.
*
* @param value allowed object is {@link String }
*
*/
public void setText(final String value) {
this.text = value;
}
/**
* The language ISO code as specified in RFC 1766.
*
* @return possible object is {@link String }
*
*/
public String getLang() {
return lang;
}
/**
* Sets the value of the lang property.
*
* @param languageCode The language as an 2 letter ISO 639-1 code.
*
*/
public void setLang(final String languageCode) {
this.lang = languageCode;
}
/**
* Fluent API builder method to get an instance with the text set.
*
* @param labelText The value for the text.
* @return The instance with the text set to the given value.
*/
public Label withText(final String labelText) {
setText(labelText);
return this;
}
/**
* Fluent API builder method to get an instance with the language set.
*
* @param languageCode The language as an 2 letter ISO 639-1 code.
* @return The instance with the language set to the given value.
*/
public Label withLang(final String languageCode) {
setLang(languageCode);
return this;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this,
ToStringStyle.SHORT_PREFIX_STYLE);
}
@Override
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
public boolean equals(final Object that) {
return EqualsBuilder.reflectionEquals(this, that);
}
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy