Search in sources :

Example 36 with SimpleInternationalString

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());
}
Also used : SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) URI(java.net.URI) Test(org.junit.Test)

Example 37 with SimpleInternationalString

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;
}
Also used : SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) InternationalString(org.opengis.util.InternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString)

Example 38 with SimpleInternationalString

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);
}
Also used : InternationalString(org.opengis.util.InternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) InternationalString(org.opengis.util.InternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) Test(org.junit.Test)

Example 39 with SimpleInternationalString

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);
}
Also used : InternationalString(org.opengis.util.InternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) Citation(org.opengis.metadata.citation.Citation) DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) CI_Citation(org.apache.sis.internal.jaxb.metadata.CI_Citation)

Example 40 with SimpleInternationalString

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);
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString)

Aggregations

SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)45 Test (org.junit.Test)20 DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)19 InternationalString (org.opengis.util.InternationalString)14 URI (java.net.URI)4 DependsOnMethod (org.apache.sis.test.DependsOnMethod)4 NamedIdentifier (org.apache.sis.referencing.NamedIdentifier)3 Citation (org.opengis.metadata.citation.Citation)3 IdentifiedObject (org.opengis.referencing.IdentifiedObject)3 Collection (java.util.Collection)2 DefaultIdentifier (org.apache.sis.metadata.iso.DefaultIdentifier)2 DefaultMetadata (org.apache.sis.metadata.iso.DefaultMetadata)2 DefaultAcquisitionInformation (org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation)2 DefaultInstrument (org.apache.sis.metadata.iso.acquisition.DefaultInstrument)2 DefaultPlatform (org.apache.sis.metadata.iso.acquisition.DefaultPlatform)2 DefaultFormat (org.apache.sis.metadata.iso.distribution.DefaultFormat)2 DefaultDataQuality (org.apache.sis.metadata.iso.quality.DefaultDataQuality)2 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 URISyntaxException (java.net.URISyntaxException)1