/** * Creates the attribute group object if it does not already exists, then returns it. * * @return the attribute group (never {@code null}). */ private DefaultAttributeGroup attributeGroup() { if (attributeGroup == null) { attributeGroup = new DefaultAttributeGroup(); } return attributeGroup; }
/** * 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. */ public DefaultAttributeGroup(final DefaultAttributeGroup object) { super(object); if (object != null) { contentTypes = copyCollection(object.getContentTypes(), CoverageContentType.class); attributes = copyCollection(object.getAttributes(), RangeDimension.class); } }
/** * Returns the types of information represented by the value(s). * * @return the types of information represented by the value(s). */ @XmlElement(name = "contentType", required = true) @UML(identifier="contentType", obligation=MANDATORY, specification=ISO_19115) public Collection<CoverageContentType> getContentTypes() { return contentTypes = nonNullCollection(contentTypes, CoverageContentType.class); }
/** Stores a legacy value into the new kind of value. */ @Override protected DefaultAttributeGroup wrap(final RangeDimension value) { final DefaultAttributeGroup container = new DefaultAttributeGroup(); container.setAttributes(asCollection(value)); return container; }
DefaultAttributeGroup group = groups[gi]; if (group == null) { group = new DefaultAttributeGroup(CoverageContentType.PHYSICAL_MEASUREMENT, null); content.getAttributeGroups().add(group); groups[gi] = group; group.getAttributes().add(band);
/** * Sets the type of information represented by the cell value. * This method stores the value in the first writable {@linkplain #getAttributeGroups() attribute groups}. * * @param newValue the new content type. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultAttributeGroup#setContentTypes(Collection)}. */ @Deprecated public void setContentType(final CoverageContentType newValue) { checkWritePermission(); final Collection<CoverageContentType> newValues = LegacyPropertyAdapter.asCollection(newValue); Collection<DefaultAttributeGroup> groups = attributeGroups; if (groups != null) { for (final DefaultAttributeGroup group : groups) { group.setContentTypes(newValues); return; // Actually stop at the first instance. } } final DefaultAttributeGroup group = new DefaultAttributeGroup(); group.setContentTypes(newValues); if (groups != null) { groups.add(group); } else { groups = Collections.<DefaultAttributeGroup>singleton(group); } setAttributeGroups(groups); }
/** * Adds type of information represented in the cell. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/contentType}</li> * </ul> * * @param type type of information represented in the cell, or {@code null} for no-operation. */ public final void addContentType(final CoverageContentType type) { if (type != null) { attributeGroup().getContentTypes().add(type); } }
/** Extracts the legacy value from the new kind of value. */ @Override protected RangeDimension unwrap(final DefaultAttributeGroup container) { return getSingleton(container.getAttributes(), RangeDimension.class, this, DefaultCoverageDescription.class, "getDimensions"); }
/** Updates the legacy value in an existing instance of the new kind of value. */ @Override protected boolean update(final DefaultAttributeGroup container, final RangeDimension value) { if (container instanceof DefaultAttributeGroup) { container.setAttributes(asCollection(value)); return true; } return false; } }.validOrNull();
DefaultAttributeGroup group = groups[gi]; if (group == null) { group = new DefaultAttributeGroup(CoverageContentType.PHYSICAL_MEASUREMENT, null); content.getAttributeGroups().add(group); groups[gi] = group; group.getAttributes().add(band);
/** Stores a legacy value into the new kind of value. */ @Override protected DefaultAttributeGroup wrap(final RangeDimension value) { final DefaultAttributeGroup container = new DefaultAttributeGroup(); container.setAttributes(asCollection(value)); return container; }
/** * Sets the type of information represented by the cell value. * This method stores the value in the first writable {@linkplain #getAttributeGroups() attribute groups}. * * @param newValue the new content type. * * @deprecated As of ISO 19115:2014, moved to {@link DefaultAttributeGroup#setContentTypes(Collection)}. */ @Deprecated public void setContentType(final CoverageContentType newValue) { checkWritePermission(valueIfDefined(attributeGroups)); final Collection<CoverageContentType> newValues = LegacyPropertyAdapter.asCollection(newValue); Collection<DefaultAttributeGroup> groups = attributeGroups; if (groups != null) { for (final DefaultAttributeGroup group : groups) { group.setContentTypes(newValues); return; // Actually stop at the first instance. } } final DefaultAttributeGroup group = new DefaultAttributeGroup(); group.setContentTypes(newValues); if (groups != null) { groups.add(group); } else { groups = Collections.<DefaultAttributeGroup>singleton(group); } setAttributeGroups(groups); }
/** * Adds type of information represented in the cell. * Storage location is: * * <ul> * <li>{@code metadata/contentInfo/attributeGroup/contentType}</li> * </ul> * * @param type type of information represented in the cell, or {@code null} for no-operation. */ public final void addContentType(final CoverageContentType type) { if (type != null) { attributeGroup().getContentTypes().add(type); } }
/** Extracts the legacy value from the new kind of value. */ @Override protected RangeDimension unwrap(final DefaultAttributeGroup container) { return getSingleton(container.getAttributes(), RangeDimension.class, this, DefaultCoverageDescription.class, "getDimensions"); }
/** Updates the legacy value in an existing instance of the new kind of value. */ @Override protected boolean update(final DefaultAttributeGroup container, final RangeDimension value) { if (container instanceof DefaultAttributeGroup) { container.setAttributes(asCollection(value)); return true; } return false; } }.validOrNull();
/** * 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. */ public DefaultAttributeGroup(final DefaultAttributeGroup object) { super(object); if (object != null) { contentTypes = copyCollection(object.getContentTypes(), CoverageContentType.class); attributes = copyCollection(object.getAttributes(), RangeDimension.class); } }
/** * Creates the attribute group object if it does not already exists, then returns it. * * @return the attribute group (never {@code null}). */ private DefaultAttributeGroup attributeGroup() { if (attributeGroup == null) { attributeGroup = new DefaultAttributeGroup(); } return attributeGroup; }
if (groups != null) { // May be null on marshalling. for (final DefaultAttributeGroup g : groups) { final Collection<? extends CoverageContentType> contentTypes = g.getContentTypes(); if (contentTypes != null) { // May be null on marshalling. for (final CoverageContentType t : contentTypes) {
/** * Commits all pending information under the coverage "attribute group" node. * If there is no pending sample dimension description, then invoking this method has no effect. * If new sample dimensions are added after this method call, they will be stored in a new element. * * <p>This method does not need to be invoked unless a new "sample dimension" node is desired.</p> */ public final void newSampleDimension() { if (sampleDimension != null) { addIfNotPresent(attributeGroup().getAttributes(), sampleDimension); sampleDimension = null; } }
/** * Returns information on an attribute of the resource. * * @return information on an attribute of the resource. */ @XmlElement(name = "attribute") @UML(identifier="attribute", obligation=OPTIONAL, specification=ISO_19115) public Collection<RangeDimension> getAttributes() { return attributes = nonNullCollection(attributes, RangeDimension.class); }