/** * 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 DefaultRangeElementDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultRangeElementDescription} instance is created using the * {@linkplain #DefaultRangeElementDescription(RangeElementDescription) 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 DefaultRangeElementDescription castOrCopy(final RangeElementDescription object) { if (object == null || object instanceof DefaultRangeElementDescription) { return (DefaultRangeElementDescription) object; } return new DefaultRangeElementDescription(object); }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <gmi:MI_RangeElementDescription>} XML element. * This is the value or a copy of the value given in argument to the {@code wrap} method. * * @return the metadata to be marshalled. */ @XmlElementRef public DefaultRangeElementDescription getElement() { return DefaultRangeElementDescription.castOrCopy(metadata); }
/** * Sets the description of a set of specific range elements. * * @param newValue the new definition value. */ public void setDefinition(final InternationalString newValue) { checkWritePermission(); definition = newValue; }
/** * Adds a description of a particular sample value. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/rangeElementDescription}</li> * </ul> * * <div class="note"><b>Note:</b> * ISO 19115 range elements are approximatively equivalent to * {@code org.apache.sis.coverage.Category} in the {@code sis-coverage} module.</div> * * @param name designation associated with a set of range elements, or {@code null} if none. * @param definition description of a set of specific range elements, or {@code null} if none. */ public void addSampleValueDescription(final CharSequence name, final CharSequence definition) { final InternationalString i18n = trim(name); final InternationalString def = trim(definition); if (i18n != null && def != null) { final DefaultRangeElementDescription element = new DefaultRangeElementDescription(); element.setName(i18n); element.setDefinition(def); addIfNotPresent(coverageDescription().getRangeElementDescriptions(), element); } }
/** * Sets the specific range elements, i.e. range elements associated with a name and their definition. * * @param newValues the new range element values. */ public void setRangeElements(final Collection<? extends Record> newValues) { rangeElements = writeCollection(newValues, rangeElements, Record.class); } }
/** * Returns the specific range elements, i.e. range elements associated with a name * and their definition. * * @return specific range elements. * * @todo implements {@link Record} in order to use the annotation. */ @Override //@XmlElement(name = "rangeElement", namespace = Namespaces.GMI, required = true) public Collection<Record> getRangeElements() { return rangeElements = nonNullCollection(rangeElements, Record.class); }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(RangeElementDescription) */ public DefaultRangeElementDescription(final RangeElementDescription object) { super(object); if (object != null) { name = object.getName(); definition = object.getDefinition(); rangeElements = copyCollection(object.getRangeElements(), Record.class); } }
/** * Adds a description of a particular sample value. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/rangeElementDescription}</li> * </ul> * * <div class="note"><b>Note:</b> * ISO 19115 range elements are approximately equivalent to * {@code org.apache.sis.coverage.Category} in the {@code sis-coverage} module.</div> * * @param name designation associated with a set of range elements, or {@code null} if none. * @param definition description of a set of specific range elements, or {@code null} if none. */ public void addSampleValueDescription(final CharSequence name, final CharSequence definition) { final InternationalString i18n = trim(name); final InternationalString def = trim(definition); if (i18n != null && def != null) { final DefaultRangeElementDescription element = new DefaultRangeElementDescription(); element.setName(i18n); element.setDefinition(def); addIfNotPresent(coverageDescription().getRangeElementDescriptions(), element); } }
/** * Sets the specific range elements, i.e. range elements associated with a name and their definition. * * @param newValues the new range element values. */ public void setRangeElements(final Collection<? extends Record> newValues) { rangeElements = writeCollection(newValues, rangeElements, Record.class); } }
/** * Returns the specific range elements, i.e. range elements associated with a name * and their definition. * * @return specific range elements. * * @todo implements {@link Record} in order to use the annotation. */ @Override @XmlElement(name = "rangeElement", required = true) public Collection<Record> getRangeElements() { return rangeElements = nonNullCollection(rangeElements, Record.class); }
/** * Constructs a new instance initialized with the values from the specified metadata object. * This is a <cite>shallow</cite> copy constructor, since the other metadata contained in the * given object are not recursively copied. * * @param object the metadata to copy values from, or {@code null} if none. * * @see #castOrCopy(RangeElementDescription) */ public DefaultRangeElementDescription(final RangeElementDescription object) { super(object); if (object != null) { name = object.getName(); definition = object.getDefinition(); rangeElements = copyCollection(object.getRangeElements(), Record.class); } }
/** * 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 DefaultRangeElementDescription}, then it is returned unchanged.</li> * <li>Otherwise a new {@code DefaultRangeElementDescription} instance is created using the * {@linkplain #DefaultRangeElementDescription(RangeElementDescription) 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 DefaultRangeElementDescription castOrCopy(final RangeElementDescription object) { if (object == null || object instanceof DefaultRangeElementDescription) { return (DefaultRangeElementDescription) object; } return new DefaultRangeElementDescription(object); }
/** * Sets the designation associated with a set of range elements. * * @param newValue the new name value. */ public void setName(final InternationalString newValue) { checkWritePermission(); name = newValue; }
/** * Invoked by JAXB at marshalling time for getting the actual metadata to write * inside the {@code <mrc:MI_RangeElementDescription>} XML element. * This is the value or a copy of the value given in argument to the {@code wrap} method. * * @return the metadata to be marshalled. */ @XmlElementRef public DefaultRangeElementDescription getElement() { return DefaultRangeElementDescription.castOrCopy(metadata); }
/** * Sets the designation associated with a set of range elements. * * @param newValue the new name value. */ public void setName(final InternationalString newValue) { checkWritePermission(name); name = newValue; }
/** * Sets the description of a set of specific range elements. * * @param newValue the new definition value. */ public void setDefinition(final InternationalString newValue) { checkWritePermission(definition); definition = newValue; }