/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultKeywords}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultKeywords} instance is created using the * {@linkplain #DefaultKeywords(Keywords) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultKeywords castOrCopy(final Keywords object) { if (object == null || object instanceof DefaultKeywords) { return (DefaultKeywords) object; } return new DefaultKeywords(object); }
/** * Returns a SIS metadata implementation with the values of the given arbitrary implementation. * This method performs the first applicable action in the following choices: * * <ul> * <li>If the given object is {@code null}, then this method returns {@code null}.</li> * <li>Otherwise if the given object is already an instance of * {@code DefaultKeywords}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultKeywords} instance is created using the * {@linkplain #DefaultKeywords(Keywords) copy constructor} * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other * metadata contained in the given object are not recursively copied.</li> * </ul> * * @param object the object to get as a SIS implementation, or {@code null} if none. * @return a SIS implementation containing the values of the given object (may be the * given object itself), or {@code null} if the argument was null. */ public static DefaultKeywords castOrCopy(final Keywords object) { if (object == null || object instanceof DefaultKeywords) { return (DefaultKeywords) object; } return new DefaultKeywords(object); }
/** * ISO 19115 metadata property determined by the {@link #keywords} field. * This is part of the information returned by {@link #getIdentificationInfo()}. * * @return category keywords, their type, and reference source. */ @Override public Collection<Keywords> getDescriptiveKeywords() { if (keywords != null) { return Collections.singleton(new DefaultKeywords(keywords.toArray(new String[keywords.size()]))); } return super.getDescriptiveKeywords(); }
/** * Tests {@link DefaultKeywords#DefaultKeywords(CharSequence[])}. */ @Test public void testConstructor() { final DefaultKeywords keywords = new DefaultKeywords("Keyword 1", "Keyword 2", "Keyword 3"); assertArrayEquals(new Object[] { new SimpleInternationalString("Keyword 1"), new SimpleInternationalString("Keyword 2"), new SimpleInternationalString("Keyword 3") }, keywords.getKeywords().toArray()); } }
if (i18n != null) { if (list == null) { group = new DefaultKeywords(); group.setType(type); group.setThesaurusName(sharedCitation(trim(thesaurusName)));
if (i18n != null) { if (list == null) { group = new DefaultKeywords(); group.setType(type); group.setThesaurusName(sharedCitation(trim(thesaurusName)));
final DefaultKeywords keywords = new DefaultKeywords( "EARTH SCIENCE > Oceans > Ocean Temperature > Sea Surface Temperature"); keywords.setType(KeywordType.THEME);
final DefaultKeywords keyword = new DefaultKeywords( new Anchor(URI.create("SDN:P021:35:ATTN"), "Transmittance and attenuance of the water column")); keyword.setType(KeywordType.THEME);