use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.
the class XLinkTest method testEquals.
/**
* Tests equality.
*
* @throws URISyntaxException if a test URI can not be parsed (should not happen).
*/
@Test
public void testEquals() throws URISyntaxException {
final XLink link = new XLink();
link.setType(XLink.Type.AUTO);
link.setRole(new URI("org:apache:sis:role"));
link.setTitle(new SimpleInternationalString("Some title"));
link.freeze();
final XLink other = new XLink();
assertFalse(link.equals(other));
assertFalse(link.hashCode() == other.hashCode());
other.setType(XLink.Type.AUTO);
assertFalse(link.equals(other));
assertFalse(link.hashCode() == other.hashCode());
other.setRole(new URI("org:apache:sis:role"));
assertFalse(link.equals(other));
assertFalse(link.hashCode() == other.hashCode());
other.setTitle(new SimpleInternationalString("Some title"));
assertEquals(link, other);
assertEquals(link.hashCode(), other.hashCode());
other.freeze();
assertEquals(link, other);
assertEquals(link.hashCode(), other.hashCode());
}
use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.
the class TableColumn method getHeader.
/**
* Returns the text to display as column header.
*
* @return the text to display as column header.
*/
public synchronized InternationalString getHeader() {
CharSequence t = header;
if (t == null || t instanceof InternationalString) {
return (InternationalString) t;
}
final InternationalString i18n = new SimpleInternationalString(t.toString());
header = i18n;
return i18n;
}
use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.
the class StringConverterTest method testInternationalString.
/**
* Tests conversions to {@link InternationalString}.
*/
@Test
public void testInternationalString() {
final ObjectConverter<String, InternationalString> c = new StringConverter.InternationalString();
runInvertibleConversion(c, "Some sentence", new SimpleInternationalString("Some sentence"));
assertSerializedEquals(c);
}
use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.
the class DefaultMetadata method setMetadataStandard.
/**
* Implementation of legacy {@link #setMetadataStandardName(String)} and
* {@link #setMetadataStandardVersion(String)} methods.
*/
private void setMetadataStandard(final boolean version, final String newValue) {
checkWritePermission();
final InternationalString i18n = (newValue != null) ? new SimpleInternationalString(newValue) : null;
final List<Citation> newValues = (metadataStandards != null) ? new ArrayList<>(metadataStandards) : new ArrayList<>(1);
DefaultCitation citation = newValues.isEmpty() ? null : DefaultCitation.castOrCopy(newValues.get(0));
if (citation == null) {
citation = new DefaultCitation();
}
if (version) {
citation.setEdition(i18n);
} else {
citation.setTitle(i18n);
}
if (newValues.isEmpty()) {
newValues.add(citation);
} else {
newValues.set(0, citation);
}
setMetadataStandards(newValues);
}
use of org.apache.sis.util.iso.SimpleInternationalString in project sis by apache.
the class DefaultMetadata method setParentIdentifier.
/**
* Sets the file identifier of the metadata to which this metadata is a subset (child).
*
* @param newValue the new parent identifier.
*
* @deprecated As of ISO 19115:2014, replaced by {@link #getParentMetadata()}.
*/
@Deprecated
public void setParentIdentifier(final String newValue) {
checkWritePermission();
// See "Note about deprecated methods implementation"
DefaultCitation parent = DefaultCitation.castOrCopy(parentMetadata);
if (parent == null) {
parent = new DefaultCitation();
}
parent.setTitle(new SimpleInternationalString(newValue));
setParentMetadata(parent);
}
Aggregations