Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -17,10 +17,12 @@ package org.apache.sis.referencing.crs; import java.util.Map; +import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.ValidationException; import org.opengis.util.FactoryException; import org.opengis.referencing.datum.Datum; import org.opengis.referencing.crs.SingleCRS; @@ -33,6 +35,8 @@ import org.opengis.referencing.operation import org.opengis.referencing.operation.MathTransformFactory; import org.opengis.geometry.MismatchedDimensionException; import org.apache.sis.referencing.operation.DefaultConversion; +import org.apache.sis.internal.jaxb.referencing.CC_Conversion; +import org.apache.sis.internal.referencing.ReferencingUtilities; import org.apache.sis.internal.metadata.ReferencingServices; import org.apache.sis.internal.system.DefaultFactories; import org.apache.sis.internal.system.Semaphores; @@ -69,18 +73,13 @@ abstract class AbstractDerivedCRS<C exte /** * The conversion from the {@linkplain #getBaseCRS() base CRS} to this CRS. * The base CRS of this {@code GeneralDerivedCRS} is {@link Conversion#getSourceCRS()}. + * + * <p><b>Consider this field as final!</b> + * This field is modified only at unmarshalling time by {@link #setConversionFromBase(Conversion)}</p> + * + * @see #getConversionFromBase() */ - @XmlElement(name = "conversion", required = true) - private final C conversionFromBase; - - /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - AbstractDerivedCRS() { - conversionFromBase = null; - } + private C conversionFromBase; /** * Creates a derived CRS from a defining conversion. @@ -201,6 +200,7 @@ abstract class AbstractDerivedCRS<C exte * @return The conversion to this CRS. */ @Override + @XmlElement(name = "conversion", required = true) public C getConversionFromBase() { return conversionFromBase; } @@ -253,4 +253,91 @@ abstract class AbstractDerivedCRS<C exte + 31 * conversionFromBase.getSourceCRS().hashCode() + 37 * conversionFromBase.getMathTransform().hashCode(); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + AbstractDerivedCRS() { + } + + /** + * Invoked by JAXB at unmarshalling time for setting the <cite>defining conversion</cite>. + * At this state, the given conversion has null {@code sourceCRS} and {@code targetCRS}. + * Those CRS will be set later, in {@link #afterUnmarshal(Unmarshaller, Object)}. + */ + private void setConversionFromBase(final C conversion) { + if (conversionFromBase == null) { + conversionFromBase = conversion; + } else { + ReferencingUtilities.propertyAlreadySet(AbstractDerivedCRS.class, "setConversionFromBase", "conversion"); + } + } + + /** + * Stores a temporary association to the given base CRS. This method shall be invoked only + * <strong>after</strong> the call to {@link #setConversionFromBase(Conversion)}, otherwise + * an exception will be thrown. + * + * <p>The given base CRS will not be stored in this {@code AbstractDerivedCRS} instance now, + * but in another temporary location. The reason is that we need the coordinate system (CS) + * before we can set the {@code baseCRS} in its final location, but the CS is not yet known + * when this method is invoked.</p> + * + * @param name The property name, used only in case of error message to format. + * @throws IllegalStateException If the base CRS can not be set. + */ + @SuppressWarnings("unchecked") + final void setBaseCRS(final String name, final SingleCRS baseCRS) { + if (conversionFromBase != null) { + final SingleCRS previous = CC_Conversion.setBaseCRS(conversionFromBase, baseCRS); + if (previous != null) { + CC_Conversion.setBaseCRS(conversionFromBase, previous); // Temporary location. + ReferencingUtilities.propertyAlreadySet(AbstractDerivedCRS.class, "setBaseCRS", name); + } + } else { + throw new IllegalStateException(Errors.format(Errors.Keys.MissingValueForProperty_1, "conversion")); + } + } + + /** + * Invoked by JAXB after all elements have been unmarshalled. At this point we should have the + * coordinate system (CS). The CS information is required by {@code createConversionFromBase(…)} + * in order to create a {@link MathTransform} with correct axis swapping and unit conversions. + */ + private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) throws ValidationException { + String property = "conversion"; + if (conversionFromBase != null) { + final SingleCRS baseCRS = CC_Conversion.setBaseCRS(conversionFromBase, null); // Clear the temporary value now. + property = "coordinateSystem"; + if (super.getCoordinateSystem() != null) { + property = "baseCRS"; + if (baseCRS != null) { + conversionFromBase = createConversionFromBase(null, baseCRS, conversionFromBase); + return; + } + } + } + /* + * If we reach this point, we failed to update the conversion. The 'baseCRS' information will be lost + * and call to 'getConversionFromBase()' will throw a ClassCastException if this instance is actually + * a ProjectedCRS (because of the method overriding with return type covariance). + */ + throw new ValidationException(Errors.format(Errors.Keys.MissingValueForProperty_1, property)); + } }
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -130,15 +130,6 @@ public class DefaultCompoundCRS extends private transient List<SingleCRS> singles; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultCompoundCRS() { - components = null; - } - - /** * Constructs a compound CRS from the given properties and CRS. * The properties given in argument follow the same rules than for the * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. @@ -328,6 +319,7 @@ public class DefaultCompoundCRS extends * * @see org.apache.sis.referencing.CRS#getSingleComponents(CoordinateReferenceSystem) */ + @SuppressWarnings("ReturnOfCollectionOrArrayField") public List<SingleCRS> getSingleComponents() { return singles; } @@ -539,4 +531,27 @@ public class DefaultCompoundCRS extends } return isWKT1 ? WKTKeywords.Compd_CS : WKTKeywords.CompoundCRS; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultCompoundCRS() { + components = null; + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -96,14 +96,6 @@ public class DefaultDerivedCRS extends A private static final long serialVersionUID = -8149602276542469876L; /** - * Constructs a new object in which every attributes are set to a default value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultDerivedCRS() { - } - - /** * Creates a derived CRS from a defining conversion. * The properties given in argument follow the same rules than for the * {@linkplain AbstractCRS#AbstractCRS(Map, CoordinateSystem) super-class constructor}. @@ -784,4 +776,26 @@ public class DefaultDerivedCRS extends A return WKTKeywords.EngineeringCRS; } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a default value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultDerivedCRS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -19,18 +19,12 @@ package org.apache.sis.referencing.crs; import java.util.Map; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; -import org.opengis.referencing.cs.AffineCS; -import org.opengis.referencing.cs.CartesianCS; import org.opengis.referencing.cs.CoordinateSystem; import org.opengis.referencing.crs.EngineeringCRS; -import org.opengis.referencing.cs.CylindricalCS; -import org.opengis.referencing.cs.LinearCS; -import org.opengis.referencing.cs.PolarCS; -import org.opengis.referencing.cs.SphericalCS; -import org.opengis.referencing.cs.UserDefinedCS; import org.opengis.referencing.datum.EngineeringDatum; -import org.apache.sis.referencing.cs.AxesConvention; +import org.apache.sis.referencing.cs.*; import org.apache.sis.referencing.AbstractReferenceSystem; import org.apache.sis.internal.metadata.WKTKeywords; import org.apache.sis.io.wkt.Formatter; @@ -68,13 +62,7 @@ import static org.apache.sis.util.Argume * @module */ @XmlType(name = "EngineeringCRSType", propOrder = { - "affineCS", - "cartesianCS", - "cylindricalCS", - "linearCS", - "polarCS", - "sphericalCS", - "userDefinedCS", + "coordinateSystem", "datum" }) @XmlRootElement(name = "EngineeringCRS") @@ -91,15 +79,6 @@ public class DefaultEngineeringCRS exten private final EngineeringDatum datum; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultEngineeringCRS() { - datum = null; - } - - /** * Creates a coordinate reference system from the given properties, datum and coordinate system. * The properties given in argument follow the same rules than for the * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. @@ -215,26 +194,23 @@ public class DefaultEngineeringCRS exten } /** - * Invoked by JAXB at marshalling time. + * Returns the coordinate system. + * + * @return The coordinate system. */ - @XmlElement(name="affineCS") private AffineCS getAffineCS() {return getCoordinateSystem(AffineCS .class);} - @XmlElement(name="cartesianCS") private CartesianCS getCartesianCS() {return getCoordinateSystem(CartesianCS .class);} - @XmlElement(name="cylindricalCS") private CylindricalCS getCylindricalCS() {return getCoordinateSystem(CylindricalCS.class);} - @XmlElement(name="linearCS") private LinearCS getLinearCS() {return getCoordinateSystem(LinearCS .class);} - @XmlElement(name="polarCS") private PolarCS getPolarCS() {return getCoordinateSystem(PolarCS .class);} - @XmlElement(name="sphericalCS") private SphericalCS getSphericalCS() {return getCoordinateSystem(SphericalCS .class);} - @XmlElement(name="userDefinedCS") private UserDefinedCS getUserDefinedCS() {return getCoordinateSystem(UserDefinedCS.class);} - - /** - * Invoked by JAXB at unmarshalling time. - */ - private void setAffineCS (final AffineCS cs) {super.setCoordinateSystem("affineCS", cs);} - private void setCartesianCS (final CartesianCS cs) {super.setCoordinateSystem("cartesianCS", cs);} - private void setCylindricalCS(final CylindricalCS cs) {super.setCoordinateSystem("cylindricalCS", cs);} - private void setLinearCS (final LinearCS cs) {super.setCoordinateSystem("linearCS", cs);} - private void setPolarCS (final PolarCS cs) {super.setCoordinateSystem("polarCS", cs);} - private void setSphericalCS (final SphericalCS cs) {super.setCoordinateSystem("sphericalCS", cs);} - private void setUserDefinedCS(final UserDefinedCS cs) {super.setCoordinateSystem("userDefinedCS", cs);} + @Override + @XmlElements({ + @XmlElement(name = "cartesianCS", type = DefaultCartesianCS.class), + @XmlElement(name = "affineCS", type = DefaultAffineCS.class), + @XmlElement(name = "cylindricalCS", type = DefaultCylindricalCS.class), + @XmlElement(name = "linearCS", type = DefaultLinearCS.class), + @XmlElement(name = "polarCS", type = DefaultPolarCS.class), + @XmlElement(name = "sphericalCS", type = DefaultSphericalCS.class), + @XmlElement(name = "userDefinedCS", type = DefaultUserDefinedCS.class) + }) + public CoordinateSystem getCoordinateSystem() { + return super.getCoordinateSystem(); + } /** * {@inheritDoc} @@ -267,4 +243,36 @@ public class DefaultEngineeringCRS exten return (formatter.getConvention().majorVersion() == 1) ? WKTKeywords.Local_CS : isBaseCRS(formatter) ? WKTKeywords.BaseEngCRS : WKTKeywords.EngineeringCRS; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultEngineeringCRS() { + datum = null; + } + + /** + * Used by JAXB only (invoked by reflection). + * + * @see #getCoordinateSystem() + */ + private void setCoordinateSystem(final CoordinateSystem cs) { + setCoordinateSystem(null, cs); // 'null' here means to infer the XML property name from the cs type. + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -79,14 +79,6 @@ public class DefaultGeocentricCRS extend private static final long serialVersionUID = 6784642848287659827L; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultGeocentricCRS() { - } - - /** * For {@link #createSameType(Map, CoordinateSystem)} usage only. * This constructor does not verify the coordinate system type. */ @@ -284,4 +276,26 @@ public class DefaultGeocentricCRS extend protected String formatTo(final Formatter formatter) { return super.formatTo(formatter); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultGeocentricCRS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -78,15 +78,6 @@ class DefaultGeodeticCRS extends Abstrac private final GeodeticDatum datum; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - DefaultGeodeticCRS() { - datum = null; - } - - /** * Creates a coordinate reference system from the given properties, datum and coordinate system. * The properties given in argument follow the same rules than for the * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. @@ -147,20 +138,6 @@ class DefaultGeodeticCRS extends Abstrac } /** - * Invoked by JAXB at marshalling time. - */ - @XmlElement(name="cartesianCS") private CartesianCS getCartesianCS() {return getCoordinateSystem(CartesianCS .class);} - @XmlElement(name="sphericalCS") private SphericalCS getSphericalCS() {return getCoordinateSystem(SphericalCS .class);} - @XmlElement(name="ellipsoidalCS") private EllipsoidalCS getEllipsoidalCS() {return getCoordinateSystem(EllipsoidalCS.class);} - - /** - * Invoked by JAXB at unmarshalling time. - */ - private void setCartesianCS (final CartesianCS cs) {super.setCoordinateSystem("cartesianCS", cs);} - private void setSphericalCS (final SphericalCS cs) {super.setCoordinateSystem("sphericalCS", cs);} - private void setEllipsoidalCS(final EllipsoidalCS cs) {super.setCoordinateSystem("ellipsoidalCS", cs);} - - /** * Returns a coordinate reference system of the same type than this CRS but with different axes. * This method shall be overridden by all {@code DefaultGeodeticCRS} subclasses in this package. */ @@ -252,4 +229,65 @@ class DefaultGeodeticCRS extends Abstrac return isBaseCRS ? WKTKeywords.BaseGeodCRS : WKTKeywords.GeodeticCRS; } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + DefaultGeodeticCRS() { + datum = null; + } + + /** + * Invoked by JAXB at marshalling time. + * + * <div class="note"><b>Implementation note:</b> + * The usual way to handle {@code <xs:choice>} with JAXB is to annotate a single method like below: + * + * {@preformat java + * @Override + * @XmlElements({ + * @XmlElement(name = "ellipsoidalCS", type = DefaultEllipsoidalCS.class), + * @XmlElement(name = "cartesianCS", type = DefaultCartesianCS.class), + * @XmlElement(name = "sphericalCS", type = DefaultSphericalCS.class) + * }) + * public CoordinateSystem getCoordinateSystem() { + * return super.getCoordinateSystem(); + * } + * } + * + * However our attempts to apply this approach worked for {@link DefaultEngineeringCRS} but not for this class: + * for an unknown reason, the unmarshalled CS object is empty. Maybe this is because the covariant return type + * in the {@link DefaultGeographicCRS} ({@code EllipsoidCS} instead than {@code CoordinateSystem} in above code) + * is causing confusion.</div> + * + * @see <a href="http://issues.apache.org/jira/browse/SIS-166">SIS-166</a> + */ + @XmlElement(name="ellipsoidalCS") private EllipsoidalCS getEllipsoidalCS() {return getCoordinateSystem(EllipsoidalCS.class);} + @XmlElement(name="cartesianCS") private CartesianCS getCartesianCS() {return getCoordinateSystem(CartesianCS .class);} + @XmlElement(name="sphericalCS") private SphericalCS getSphericalCS() {return getCoordinateSystem(SphericalCS .class);} + + /** + * Invoked by JAXB at unmarshalling time. + * + * @see #getEllipsoidalCS() + */ + private void setEllipsoidalCS(final EllipsoidalCS cs) {super.setCoordinateSystem("ellipsoidalCS", cs);} + private void setCartesianCS (final CartesianCS cs) {super.setCoordinateSystem("cartesianCS", cs);} + private void setSphericalCS (final SphericalCS cs) {super.setCoordinateSystem("sphericalCS", cs);} } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -104,14 +104,6 @@ public class DefaultGeographicCRS extend private static final long serialVersionUID = 861224913438092335L; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultGeographicCRS() { - } - - /** * Creates a coordinate reference system from the given properties, datum and coordinate system. * The properties given in argument follow the same rules than for the * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. @@ -168,21 +160,6 @@ public class DefaultGeographicCRS extend } /** - * For {@link SC_GeographicCRS} JAXB adapter only. This is needed because GML does not have "GeographicCRS" type. - * Instead, the unmarshalling process will give us a "GeodeticCRS" object with the constraint that the coordinate - * system shall be ellipsoidal. This constructor will be invoked for converting the GeodeticCRS instance to a - * GeographicCRS instance. - */ - DefaultGeographicCRS(final GeodeticCRS crs) { - super(crs); - final CoordinateSystem cs = super.getCoordinateSystem(); - if (!(cs instanceof EllipsoidalCS)) { - throw new IllegalArgumentException(Errors.format( - Errors.Keys.IllegalClass_2, EllipsoidalCS.class, cs.getClass())); - } - } - - /** * Constructs a new coordinate reference system with the same values than the specified one. * This copy constructor provides a way to convert an arbitrary implementation into a SIS one * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. @@ -333,4 +310,41 @@ public class DefaultGeographicCRS extend protected String formatTo(final Formatter formatter) { return super.formatTo(formatter); } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultGeographicCRS() { + } + + /** + * For {@link SC_GeographicCRS} JAXB adapter only. This is needed because GML does not have "GeographicCRS" type. + * Instead, the unmarshalling process will give us a "GeodeticCRS" object with the constraint that the coordinate + * system shall be ellipsoidal. This constructor will be invoked for converting the GeodeticCRS instance to a + * GeographicCRS instance. + */ + DefaultGeographicCRS(final GeodeticCRS crs) { + super(crs); + final CoordinateSystem cs = super.getCoordinateSystem(); + if (!(cs instanceof EllipsoidalCS)) { + throw new IllegalArgumentException(Errors.format( + Errors.Keys.IllegalClass_2, EllipsoidalCS.class, cs.getClass())); + } + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -72,15 +72,6 @@ public class DefaultImageCRS extends Abs private final ImageDatum datum; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultImageCRS() { - datum = null; - } - - /** * Creates a coordinate reference system from the given properties, datum and coordinate system. * The properties given in argument follow the same rules than for the * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. @@ -206,38 +197,6 @@ public class DefaultImageCRS extends Abs } /** - * Used by JAXB only (invoked by reflection). - * Only one of {@code getAffineCS()} and {@link #getCartesianCS()} can return a non-null value. - */ - @XmlElement(name = "affineCS") - private AffineCS getAffineCS() { - return getCoordinateSystem(AffineCS.class); - } - - /** - * Used by JAXB only (invoked by reflection). - * Only one of {@link #getAffineCS()} and {@code getCartesianCS()} can return a non-null value. - */ - @XmlElement(name = "cartesianCS") - private CartesianCS getCartesianCS() { - return getCoordinateSystem(CartesianCS.class); - } - - /** - * Used by JAXB only (invoked by reflection). - */ - private void setAffineCS(final AffineCS cs) { - setCoordinateSystem("affineCS", cs); - } - - /** - * Used by JAXB only (invoked by reflection). - */ - private void setCartesianCS(final CartesianCS cs) { - setCoordinateSystem("cartesianCS", cs); - } - - /** * {@inheritDoc} * * @return {@inheritDoc} @@ -273,4 +232,62 @@ public class DefaultImageCRS extends Abs } return WKTKeywords.ImageCRS; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultImageCRS() { + datum = null; + } + + /** + * Used by JAXB only (invoked by reflection). + * Only one of {@code getCartesianCS()} and {@link #getAffineCS()} can return a non-null value. + * + * <div class="note"><b>Implementation note:</b> + * The usual way to handle {@code <xs:choice>} with JAXB is to annotate a single method like below: + * + * {@preformat java + * @Override + * @XmlElements({ + * @XmlElement(name = "cartesianCS", type = DefaultCartesianCS.class), + * @XmlElement(name = "affineCS", type = DefaultAffineCS.class) + * }) + * public AffineCS getCoordinateSystem() { + * return super.getCoordinateSystem(); + * } + * } + * + * However our attempts to apply this approach worked for {@link DefaultEngineeringCRS} but not for this class: + * for an unknown reason, the unmarshalled CS object is empty. Maybe this is because the covariant return type + * ({@code AffineCS} instead than {@code CoordinateSystem} in above code) is causing confusion.</div> + * + * @see <a href="http://issues.apache.org/jira/browse/SIS-166">SIS-166</a> + */ + @XmlElement(name = "cartesianCS") private CartesianCS getCartesianCS() {return getCoordinateSystem(CartesianCS.class);} + @XmlElement(name = "affineCS") private AffineCS getAffineCS() {return getCoordinateSystem(AffineCS.class);} + + /** + * Used by JAXB only (invoked by reflection). + * + * @see #getCartesianCS() + */ + private void setCartesianCS(final CartesianCS cs) {setCoordinateSystem("cartesianCS", cs);} + private void setAffineCS (final AffineCS cs) {setCoordinateSystem("affineCS", cs);} } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -85,14 +85,6 @@ public class DefaultProjectedCRS extends private static final long serialVersionUID = -4502680112031773028L; /** - * Constructs a new object in which every attributes are set to a default value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultProjectedCRS() { - } - - /** * Creates a projected CRS from a defining conversion. * The properties given in argument follow the same rules than for the * {@linkplain AbstractCRS#AbstractCRS(Map, CoordinateSystem) super-class constructor}. @@ -271,13 +263,6 @@ public class DefaultProjectedCRS extends } /** - * Used by JAXB only (invoked by reflection). - */ - private void setCoordinateSystem(final CartesianCS cs) { - setCoordinateSystem("cartesianCS", cs); - } - - /** * {@inheritDoc} * * @return {@inheritDoc} @@ -492,4 +477,44 @@ public class DefaultProjectedCRS extends } } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a default value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultProjectedCRS() { + } + + /** + * Used by JAXB only (invoked by reflection). + * + * @see #getBaseCRS() + */ + private void setBaseCRS(final GeographicCRS crs) { + setBaseCRS("baseGeodeticCRS", crs); + } + + /** + * Used by JAXB only (invoked by reflection). + * + * @see #getCoordinateSystem() + */ + private void setCoordinateSystem(final CartesianCS cs) { + setCoordinateSystem("cartesianCS", cs); + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -93,15 +93,6 @@ public class DefaultTemporalCRS extends private transient long origin; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultTemporalCRS() { - datum = null; - } - - /** * Creates a coordinate reference system from the given properties, datum and coordinate system. * The properties given in argument follow the same rules than for the * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. @@ -236,13 +227,6 @@ public class DefaultTemporalCRS extends } /** - * Used by JAXB only (invoked by reflection). - */ - private void setCoordinateSystem(final TimeCS cs) { - setCoordinateSystem("timeCS", cs); - } - - /** * {@inheritDoc} * * @return {@inheritDoc} @@ -316,4 +300,36 @@ public class DefaultTemporalCRS extends } return isBaseCRS(formatter) ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultTemporalCRS() { + datum = null; + } + + /** + * Used by JAXB only (invoked by reflection). + * + * @see #getCoordinateSystem() + */ + private void setCoordinateSystem(final TimeCS cs) { + setCoordinateSystem("timeCS", cs); + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -72,15 +72,6 @@ public class DefaultVerticalCRS extends private final VerticalDatum datum; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultVerticalCRS() { - datum = null; - } - - /** * Creates a coordinate reference system from the given properties, datum and coordinate system. * The properties given in argument follow the same rules than for the * {@linkplain AbstractReferenceSystem#AbstractReferenceSystem(Map) super-class constructor}. @@ -207,13 +198,6 @@ public class DefaultVerticalCRS extends } /** - * Used by JAXB only (invoked by reflection). - */ - private void setCoordinateSystem(final VerticalCS cs) { - setCoordinateSystem("verticalCS", cs); - } - - /** * {@inheritDoc} * * @return {@inheritDoc} @@ -244,4 +228,36 @@ public class DefaultVerticalCRS extends return (formatter.getConvention().majorVersion() == 1) ? WKTKeywords.Vert_CS : isBaseCRS(formatter) ? WKTKeywords.BaseVertCRS : WKTKeywords.VerticalCRS; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultVerticalCRS() { + datum = null; + } + + /** + * Used by JAXB only (invoked by reflection). + * + * @see #getCoordinateSystem() + */ + private void setCoordinateSystem(final VerticalCS cs) { + setCoordinateSystem("verticalCS", cs); + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SC_GeographicCRS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SC_GeographicCRS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SC_GeographicCRS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SC_GeographicCRS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -16,8 +16,8 @@ */ package org.apache.sis.referencing.crs; -import org.opengis.referencing.crs.GeographicCRS; import javax.xml.bind.annotation.XmlElement; +import org.opengis.referencing.crs.GeographicCRS; import org.apache.sis.internal.jaxb.gco.PropertyType; Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -98,11 +98,6 @@ public class AbstractCS extends Abstract static final int VALID = 0, INVALID_DIRECTION = 1, INVALID_UNIT = 2; /** - * An empty array of axes, used only for JAXB. - */ - private static final CoordinateSystemAxis[] EMPTY = new CoordinateSystemAxis[0]; - - /** * The sequence of axes for this coordinate system. */ @XmlElement(name = "axis") @@ -117,16 +112,6 @@ public class AbstractCS extends Abstract private transient Map<AxesConvention,AbstractCS> derived; /** - * Constructs a new object in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved - * to JAXB, which will assign values to the fields using reflexion. - */ - AbstractCS() { - super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE); - axes = EMPTY; - } - - /** * Constructs a coordinate system from a set of properties and a sequence of axes. * The properties map is given unchanged to the * {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}. @@ -470,4 +455,33 @@ public class AbstractCS extends Abstract formatter.append(getDimension()); return WKTKeywords.CS; } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * An empty array of axes, used only for JAXB. + */ + private static final CoordinateSystemAxis[] EMPTY = new CoordinateSystemAxis[0]; + + /** + * Constructs a new object in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved + * to JAXB, which will assign values to the fields using reflexion. + */ + AbstractCS() { + super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE); + axes = EMPTY; + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -282,6 +282,8 @@ public final class CoordinateSystems ext final CoordinateSystem targetCS) throws IllegalArgumentException, ConversionException { + ensureNonNull("sourceCS", sourceCS); + ensureNonNull("targetCS", targetCS); if (!Classes.implementSameInterfaces(sourceCS.getClass(), targetCS.getClass(), CoordinateSystem.class)) { throw new IllegalArgumentException(Errors.format(Errors.Keys.IncompatibleCoordinateSystemTypes)); } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -64,14 +64,6 @@ public class DefaultAffineCS extends Abs private static final long serialVersionUID = 7977674229369042440L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - DefaultAffineCS() { - } - - /** * Constructs a coordinate system of arbitrary dimension. This constructor is * not public because {@code AffineCS} are restricted to 2 and 3 dimensions. */ @@ -234,4 +226,26 @@ public class DefaultAffineCS extends Abs default: throw unexpectedDimension(properties, axes, 2); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + DefaultAffineCS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -69,14 +69,6 @@ public class DefaultCartesianCS extends private static final long serialVersionUID = -6182037957705712945L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - private DefaultCartesianCS() { - } - - /** * Creates a new coordinate system from an arbitrary number of axes. This constructor is for * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only, * because it does not verify the number of axes. @@ -242,4 +234,26 @@ public class DefaultCartesianCS extends default: throw unexpectedDimension(properties, axes, 2); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + private DefaultCartesianCS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -213,21 +213,6 @@ public class DefaultCoordinateSystemAxis private final RangeMeaning rangeMeaning; /** - * Constructs a new object in which every attributes are set to a null value. - * <strong>This is not a valid object.</strong> This constructor is strictly - * reserved to JAXB, which will assign values to the fields using reflexion. - */ - private DefaultCoordinateSystemAxis() { - super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE); - abbreviation = null; - direction = null; - unit = null; - rangeMeaning = null; - minimumValue = NEGATIVE_INFINITY; - maximumValue = POSITIVE_INFINITY; - } - - /** * Constructs an axis from a set of properties. The properties given in argument follow the same rules * than for the {@linkplain AbstractIdentifiedObject#AbstractIdentifiedObject(Map) super-class constructor}. * Additionally, the following properties are understood by this constructor: @@ -452,30 +437,6 @@ public class DefaultCoordinateSystemAxis } /** - * Invoke by JAXB at marshalling time for fetching the minimum value, or {@code null} if none. - */ - @XmlElement(name = "minimumValue") - private Double getMinimum() { - return (minimumValue != NEGATIVE_INFINITY) ? minimumValue : null; - } - - /** - * Invoked by JAXB at unmarshalling time for setting the minimum value. - */ - private void setMinimum(final Double value) { - if (value != null && ReferencingUtilities.canSetProperty(DefaultCoordinateSystemAxis.class, - "setMinimum", "minimumValue", minimumValue != NEGATIVE_INFINITY)) - { - final double min = value; // Apply unboxing. - if (min < maximumValue) { - minimumValue = min; - } else { - outOfRange("minimumValue", value); - } - } - } - - /** * Returns the maximum value normally allowed for this axis, in the {@linkplain #getUnit() * unit of measure for the axis}. If there is no maximum value, then this method returns * {@linkplain Double#POSITIVE_INFINITY negative infinity}. @@ -488,30 +449,6 @@ public class DefaultCoordinateSystemAxis } /** - * Invoke by JAXB at marshalling time for fetching the maximum value, or {@code null} if none. - */ - @XmlElement(name = "maximumValue") - private Double getMaximum() { - return (maximumValue != POSITIVE_INFINITY) ? maximumValue : null; - } - - /** - * Invoked by JAXB at unmarshalling time for setting the maximum value. - */ - private void setMaximum(final Double value) { - if (value != null && ReferencingUtilities.canSetProperty(DefaultCoordinateSystemAxis.class, - "setMaximum", "maximumValue", maximumValue != POSITIVE_INFINITY)) - { - final double max = value; // Apply unboxing. - if (max > minimumValue) { - maximumValue = max; - } else { - outOfRange("maximumValue", value); - } - } - } - - /** * Invoked at unmarshalling time if a minimum or maximum value is out of range. * * @param name The property name. Will also be used as "method" name for logging purpose, @@ -895,4 +832,85 @@ public class DefaultCoordinateSystemAxis return WKTKeywords.Order; } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new object in which every attributes are set to a null value. + * <strong>This is not a valid object.</strong> This constructor is strictly + * reserved to JAXB, which will assign values to the fields using reflexion. + */ + private DefaultCoordinateSystemAxis() { + super(org.apache.sis.internal.referencing.NilReferencingObject.INSTANCE); + abbreviation = null; + direction = null; + unit = null; + rangeMeaning = null; + minimumValue = NEGATIVE_INFINITY; + maximumValue = POSITIVE_INFINITY; + } + + /** + * Invoked by JAXB at marshalling time for fetching the minimum value, or {@code null} if none. + * + * @see #getMinimumValue() + */ + @XmlElement(name = "minimumValue") + private Double getMinimum() { + return (minimumValue != NEGATIVE_INFINITY) ? minimumValue : null; + } + + /** + * Invoked by JAXB at unmarshalling time for setting the minimum value. + */ + private void setMinimum(final Double value) { + if (minimumValue == NEGATIVE_INFINITY) { + final double min = value; // Apply unboxing. + if (min < maximumValue) { + minimumValue = min; + } else { + outOfRange("minimumValue", value); + } + } else { + ReferencingUtilities.propertyAlreadySet(DefaultCoordinateSystemAxis.class, "setMinimum", "minimumValue"); + } + } + + /** + * Invoked by JAXB at marshalling time for fetching the maximum value, or {@code null} if none. + * + * @see #getMaximumValue() + */ + @XmlElement(name = "maximumValue") + private Double getMaximum() { + return (maximumValue != POSITIVE_INFINITY) ? maximumValue : null; + } + + /** + * Invoked by JAXB at unmarshalling time for setting the maximum value. + */ + private void setMaximum(final Double value) { + if (maximumValue == POSITIVE_INFINITY) { + final double max = value; // Apply unboxing. + if (max > minimumValue) { + maximumValue = max; + } else { + outOfRange("maximumValue", value); + } + } else { + ReferencingUtilities.propertyAlreadySet(DefaultCoordinateSystemAxis.class, "setMaximum", "maximumValue"); + } + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -63,14 +63,6 @@ public class DefaultCylindricalCS extend private static final long serialVersionUID = -8290402732390917907L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - private DefaultCylindricalCS() { - } - - /** * Creates a new coordinate system from an arbitrary number of axes. This constructor is for * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only, * because it does not verify the number of axes. @@ -213,4 +205,26 @@ public class DefaultCylindricalCS extend default: throw unexpectedDimension(properties, axes, 2); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + private DefaultCylindricalCS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -61,14 +61,6 @@ public class DefaultEllipsoidalCS extend private static final long serialVersionUID = -1452492488902329211L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - private DefaultEllipsoidalCS() { - } - - /** * Creates a new coordinate system from an arbitrary number of axes. This constructor is for * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only, * because it does not verify the number of axes. @@ -252,4 +244,26 @@ public class DefaultEllipsoidalCS extend default: throw unexpectedDimension(properties, axes, 1); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + private DefaultEllipsoidalCS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -62,14 +62,6 @@ public class DefaultLinearCS extends Abs private static final long serialVersionUID = -6890723478287625763L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - private DefaultLinearCS() { - } - - /** * Creates a new coordinate system from an arbitrary number of axes. This constructor is for * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only, * because it does not verify the number of axes. @@ -205,4 +197,26 @@ public class DefaultLinearCS extends Abs default: throw unexpectedDimension(properties, axes, 1); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + private DefaultLinearCS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -61,14 +61,6 @@ public class DefaultPolarCS extends Abst private static final long serialVersionUID = 3960197260975470951L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - private DefaultPolarCS() { - } - - /** * Creates a new coordinate system from an arbitrary number of axes. This constructor is for * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only, * because it does not verify the number of axes. @@ -208,4 +200,26 @@ public class DefaultPolarCS extends Abst default: throw unexpectedDimension(properties, axes, 2); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + private DefaultPolarCS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -65,14 +65,6 @@ public class DefaultSphericalCS extends private static final long serialVersionUID = 196295996465774477L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - private DefaultSphericalCS() { - } - - /** * Creates a new coordinate system from an arbitrary number of axes. This constructor is for * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only, * because it does not verify the number of axes. @@ -213,4 +205,26 @@ public class DefaultSphericalCS extends default: throw unexpectedDimension(properties, axes, 2); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + private DefaultSphericalCS() { + } } Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java?rev=1701516&r1=1701515&r2=1701516&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] Sun Sep 6 19:10:30 2015 @@ -64,14 +64,6 @@ public class DefaultTimeCS extends Abstr private static final long serialVersionUID = 5222911412381303989L; /** - * Constructs a new coordinate system in which every attributes are set to a null or empty value. - * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, - * which will assign values to the fields using reflexion. - */ - private DefaultTimeCS() { - } - - /** * Creates a new coordinate system from an arbitrary number of axes. This constructor is for * implementations of the {@link #createForAxes(Map, CoordinateSystemAxis[])} method only, * because it does not verify the number of axes. @@ -205,4 +197,26 @@ public class DefaultTimeCS extends Abstr default: throw unexpectedDimension(properties, axes, 1); } } + + + + + ////////////////////////////////////////////////////////////////////////////////////////////////// + //////// //////// + //////// XML support with JAXB //////// + //////// //////// + //////// The following methods are invoked by JAXB using reflection (even if //////// + //////// they are private) or are helpers for other methods invoked by JAXB. //////// + //////// Those methods can be safely removed if Geographic Markup Language //////// + //////// (GML) support is not needed. //////// + //////// //////// + ////////////////////////////////////////////////////////////////////////////////////////////////// + + /** + * Constructs a new coordinate system in which every attributes are set to a null or empty value. + * <strong>This is not a valid object.</strong> This constructor is strictly reserved to JAXB, + * which will assign values to the fields using reflexion. + */ + private DefaultTimeCS() { + } }
