/** * Invoked by JAXB {@link javax.xml.bind.Marshaller} before this object is marshalled to XML. * This method sets the locale to be used for XML marshalling to the metadata language. */ @SuppressWarnings("unused") private void beforeMarshal(final Marshaller marshaller) { Context.push(CollectionsExt.first(languages)); }
/** * Returns the "main" namespace of the given factory, or {@code null} if none. * Current implementation returns the first namespace, but this may be changed in any future SIS version. * * <p>The purpose of this method is to get a unique identifier of a factory, ignoring version number.</p> */ static String getCodeSpace(final AuthorityFactory factory) { return CollectionsExt.first(getCodeSpaces(factory)); }
/** * Returns the "main" namespace of the given factory, or {@code null} if none. * Current implementation returns the first namespace, but this may be changed in any future SIS version. * * <p>The purpose of this method is to get a unique identifier of a factory, ignoring version number.</p> */ static String getCodeSpace(final AuthorityFactory factory) { return CollectionsExt.first(getCodeSpaces(factory)); }
/** * Invoked by JAXB {@link javax.xml.bind.Marshaller} before this object is marshalled to XML. * This method sets the locale to be used for XML marshalling to the metadata language. */ private void beforeMarshal(final Marshaller marshaller) { Context.push(CollectionsExt.first(languages)); }
/** * Gets the default locale for this record (used in ISO 19115-3 format). */ @XmlElement(name = "defaultLocale") private Locale getDefaultLocale() { return FilterByVersion.CURRENT_METADATA.accept() ? CollectionsExt.first(getLanguages()) : null; }
/** * Gets the default locale for this record (used in ISO 19115-3 format). */ @XmlElement(name = "defaultLocale") private Locale getDefaultLocale() { return FilterByVersion.CURRENT_METADATA.accept() ? CollectionsExt.first(getLanguages()) : null; }
/** * Returns the default language used for documenting metadata. * * @return language used for documenting metadata, or {@code null}. * * @deprecated As of GeoAPI 3.1, replaced by {@link #getLanguages()}. */ @Override @Deprecated @XmlElement(name = "language") @Dependencies("getLanguages") public Locale getLanguage() { return CollectionsExt.first(getLanguages()); /* * No warning if the collection contains more than one locale, because * this is allowed by the "getLanguage() + getLocales()" contract. */ }
/** * Sets the other locales for this record (used in ISO 19115-3 format). */ private void setOtherLocales(final Collection<? extends Locale> newValues) { setLanguages(OtherLocales.merge(CollectionsExt.first(languages), newValues)); }
switch (collection.size()) { case 0: collection = Collections.emptySet(); break; case 1: collection = Collections.singleton(CollectionsExt.first(collection)); break; default: collection = Collections.unmodifiableSet(new LinkedHashSet<>(collection)); break;
switch (collection.size()) { case 0: collection = Collections.emptySet(); break; case 1: collection = Collections.singleton(CollectionsExt.first(collection)); break; default: collection = Collections.unmodifiableSet(new LinkedHashSet<>(collection)); break;
/** * Sets information about an alternatively used localized character string for a linguistic extension. * * @param newValues the new locales. * * @deprecated As of GeoAPI 3.1, replaced by {@link #setLanguages(Collection)}. */ @Deprecated public void setLocales(final Collection<? extends Locale> newValues) { checkWritePermission(); setLanguages(OtherLocales.merge(CollectionsExt.first(languages), newValues)); // See "Note about deprecated methods implementation" }
/** * Returns the default language used for documenting metadata. * * @return language used for documenting metadata, or {@code null}. * * @deprecated As of SIS 0.5, replaced by {@link #getLanguages()}. */ @Override @Deprecated @Dependencies("getLanguages") @XmlElement(name = "language", namespace = LegacyNamespaces.GMD) @XmlJavaTypeAdapter(LocaleAdapter.class) public Locale getLanguage() { return FilterByVersion.LEGACY_METADATA.accept() ? CollectionsExt.first(getLanguages()) : null; /* * No warning if the collection contains more than one locale, because * this is allowed by the "getLanguage() + getLocales()" contract. */ }
/** * If the given property is a link, returns the name of the referenced property. * Otherwise returns {@code null}. * * @param property the property to test, or {@code null} if none. * @return the referenced property name, or {@code null} if none. */ static String linkOf(final AbstractIdentifiedType property) { if (property instanceof AbstractOperation) { final AbstractOperation op = (AbstractOperation) property; if (op.getParameters() == LINK_PARAMS) { /* * The dependencies collection contains exactly one element on Apache SIS implementation. * However the user could define his own operation with the same parameter descriptor name. * This is unlikely since it would probably be a bug, but we are paranoiac. */ return CollectionsExt.first(op.getDependencies()); } } return null; }
/** * If the given property is a link, returns the name of the referenced property. * Otherwise returns {@code null}. * * @param property the property to test, or {@code null} if none. * @return the referenced property name, or {@code null} if none. */ static String linkOf(final AbstractIdentifiedType property) { if (property instanceof AbstractOperation) { final AbstractOperation op = (AbstractOperation) property; if (op.getParameters() == LINK_PARAMS) { /* * The dependencies collection contains exactly one element on Apache SIS implementation. * However the user could define his own operation with the same parameter descriptor name. * This is unlikely since it would probably be a bug, but we are paranoiac. */ return CollectionsExt.first(op.getDependencies()); } } return null; } }
GenericName name = first(wkt.getAlias()); if (name == null) {
GenericName name = first(wkt.getAlias()); if (name == null) {
checkWritePermission(); AbstractIdentification firstId = AbstractIdentification.castOrCopy(CollectionsExt.first(info)); if (firstId == null) { firstId = new DefaultDataIdentification(); DefaultOnlineResource firstOnline = DefaultOnlineResource.castOrCopy(CollectionsExt.first(onlineResources)); if (firstOnline == null) { firstOnline = new DefaultOnlineResource();
AbstractIdentification firstId = AbstractIdentification.castOrCopy(CollectionsExt.first(info)); if (firstId == null) { firstId = new DefaultDataIdentification(); DefaultOnlineResource firstOnline = DefaultOnlineResource.castOrCopy(CollectionsExt.first(onlineResources)); if (firstOnline == null) { firstOnline = new DefaultOnlineResource();
final InternationalString expectedAltTitle = first(fromDB.getAlternateTitles()); final InternationalString actualAltTitle = first(fromFB.getAlternateTitles()); if (fromFB.getTitle().equals(expectedAltTitle)) { assertNull(name, actualAltTitle); final Identifier expectedID = first(fromDB.getIdentifiers()); final Identifier actualID = first(fromFB.getIdentifiers()); if (expectedID == null) { assertNull(name, actualID); final ResponsibleParty expectedResp = first(fromDB.getCitedResponsibleParties()); final ResponsibleParty actualResp = first(fromFB.getCitedResponsibleParties()); if (expectedResp == null) { assertNull(name, actualResp); assertEquals(name, first(fromDB.getPresentationForms()), first(fromFB.getPresentationForms()));