Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultPassThroughOperation.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -17,10 +17,8 @@ package org.apache.sis.referencing.operation; import java.util.Map; -import org.opengis.parameter.ParameterValueGroup; import org.opengis.referencing.operation.MathTransform; -import org.opengis.referencing.operation.OperationMethod; -import org.opengis.referencing.operation.SingleOperation; +import org.opengis.referencing.operation.CoordinateOperation; import org.opengis.referencing.operation.PassThroughOperation; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.referencing.operation.transform.PassThroughTransform; @@ -51,7 +49,7 @@ public class DefaultPassThroughOperation /** * The operation to apply on the subset of a coordinate tuple. */ - private final SingleOperation operation; + private final CoordinateOperation operation; /** * Constructs a single operation from a set of properties. @@ -89,7 +87,7 @@ public class DefaultPassThroughOperation public DefaultPassThroughOperation(final Map<String,?> properties, final CoordinateReferenceSystem sourceCRS, final CoordinateReferenceSystem targetCRS, - final SingleOperation operation, + final CoordinateOperation operation, final int firstAffectedOrdinate, final int numTrailingOrdinates) { @@ -149,28 +147,6 @@ public class DefaultPassThroughOperation } /** - * @deprecated May be removed in GeoAPI 4.0 since it does not apply to pass-through operations. - * - * @return {@code null}. - */ - @Override - @Deprecated - public OperationMethod getMethod() { - return null; - } - - /** - * @deprecated May be removed in GeoAPI 4.0 since it does not apply to pass-through operations. - * - * @return {@code null}. - */ - @Override - @Deprecated - public ParameterValueGroup getParameterValues() { - return null; - } - - /** * Returns the operation to apply on the subset of a coordinate tuple. * * @return The operation to apply on the subset of a coordinate tuple. @@ -178,7 +154,7 @@ public class DefaultPassThroughOperation * @see PassThroughTransform#getSubTransform() */ @Override - public SingleOperation getOperation() { + public CoordinateOperation getOperation() { return operation; }
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -45,6 +45,7 @@ import static org.apache.sis.test.Metada * @version 0.6 * @module */ +@SuppressWarnings("UnnecessaryBoxing") @DependsOn(DefaultParameterDescriptorTest.class) public final strictfp class DefaultParameterValueTest extends TestCase { /** Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterBuilderTest.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -77,6 +77,7 @@ public final strictfp class ParameterBui */ @Test @DependsOnMethod("testCreate") + @SuppressWarnings("UnnecessaryBoxing") public void testMercatorProjection() { final ParameterBuilder builder = new ParameterBuilder(); builder.setCodeSpace(Citations.EPSG, "EPSG").setRequired(true); Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterFormatTest.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -58,23 +58,36 @@ public final strictfp class ParameterFor * Creates the parameter descriptors to be used by all tests in this class. This method creates * a variant of the example documented in the {@link DefaultParameterDescriptorGroup} javadoc * with arbitrary non-zero default values. + * + * <div class="note"><b>Note:</b> + * the default values are not part of EPSG definitions. They are added here only for testing purpose.</div> */ @BeforeClass public static void createParameterDescriptor() { + descriptor = createMercatorParameters(); + } + + /** + * Creates the test parameter for the Mercator projection, to be shared by {@link ParameterMarshallingTest}. + * + * <div class="note"><b>Note:</b> + * the default values are not part of EPSG definitions. They are added here only for testing purpose.</div> + */ + static ParameterDescriptorGroup createMercatorParameters() { ParameterBuilder builder = new ParameterBuilder(); builder.setCodeSpace(EPSG, "EPSG").setRequired(true); ParameterDescriptor<?>[] parameters = { - builder.addName("Latitude of natural origin") .addName(OGC, "latitude_of_origin").createBounded( -80, +84, 40, NonSI.DEGREE_ANGLE), - builder.addName("Longitude of natural origin") .addName(OGC, "central_meridian") .createBounded(-180, +180, -60, NonSI.DEGREE_ANGLE), - builder.addName("Scale factor at natural origin") .addName(OGC, "scale_factor") .createStrictlyPositive(1, Unit.ONE), - builder.addName("False easting").setRequired(false).addName(OGC, "false_easting") .create( 5000, SI.METRE), - builder.addName("False northing") .addName(OGC, "false_northing") .create(10000, SI.METRE) + builder.addIdentifier("8801").addName("Latitude of natural origin") .addName(OGC, "latitude_of_origin").createBounded( -80, +84, 40, NonSI.DEGREE_ANGLE), + builder.addIdentifier("8802").addName("Longitude of natural origin") .addName(OGC, "central_meridian") .createBounded(-180, +180, -60, NonSI.DEGREE_ANGLE), + builder.addIdentifier("8805").addName("Scale factor at natural origin") .addName(OGC, "scale_factor") .createStrictlyPositive(1, Unit.ONE), + builder.addIdentifier("8806").addName("False easting").setRequired(false).addName(OGC, "false_easting") .create( 5000, SI.METRE), + builder.addIdentifier("8807").addName("False northing") .addName(OGC, "false_northing") .create(10000, SI.METRE) }; builder.addIdentifier("9804") .addName("Mercator (variant A)") .addName("Mercator (1SP)") .addName(OGC, "Mercator_1SP"); - descriptor = builder.createGroup(parameters); + return builder.createGroup(parameters); } /** @@ -175,6 +188,10 @@ public final strictfp class ParameterFor /** * Tests {@link ParameterFormat#format(Object, Appendable)} for descriptors with {@code ContentLevel.DETAILED}. + * + * <div class="note"><b>Note:</b> + * the default values expected by this method are not part of EPSG definitions. + * They are added here only for testing purpose.</div> */ @Test public void testFormatDetailedDescriptors() { @@ -185,24 +202,24 @@ public final strictfp class ParameterFor "EPSG: Mercator (variant A) (9804)\n" + "EPSG: Mercator (1SP)\n" + "OGC: Mercator_1SP\n" + - "╔══════════════════════════════════════╤════════╤════════════╤═══════════════╤═══════════════╗\n" + - "║ Name │ Type │ Obligation │ Value domain │ Default value ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + - "║ EPSG: Latitude of natural origin │ Double │ Mandatory │ [-80 … 84]° │ 40.0° ║\n" + - "║ OGC: latitude_of_origin │ │ │ │ ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + - "║ EPSG: Longitude of natural origin │ Double │ Mandatory │ [-180 … 180]° │ -60.0° ║\n" + - "║ OGC: central_meridian │ │ │ │ ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + - "║ EPSG: Scale factor at natural origin │ Double │ Mandatory │ (0 … ∞) │ 1.0 ║\n" + - "║ OGC: scale_factor │ │ │ │ ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + - "║ EPSG: False easting │ Double │ Optional │ (-∞ … ∞) m │ 5000.0 m ║\n" + - "║ OGC: false_easting │ │ │ │ ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + - "║ EPSG: False northing │ Double │ Optional │ (-∞ … ∞) m │ 10000.0 m ║\n" + - "║ OGC: false_northing │ │ │ │ ║\n" + - "╚══════════════════════════════════════╧════════╧════════════╧═══════════════╧═══════════════╝\n", text); + "╔═════════════════════════════════════════════╤════════╤════════════╤═══════════════╤═══════════════╗\n" + + "║ Name │ Type │ Obligation │ Value domain │ Default value ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + + "║ EPSG: Latitude of natural origin (8801) │ Double │ Mandatory │ [-80 … 84]° │ 40.0° ║\n" + + "║ OGC: latitude_of_origin │ │ │ │ ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + + "║ EPSG: Longitude of natural origin (8802) │ Double │ Mandatory │ [-180 … 180]° │ -60.0° ║\n" + + "║ OGC: central_meridian │ │ │ │ ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + + "║ EPSG: Scale factor at natural origin (8805) │ Double │ Mandatory │ (0 … ∞) │ 1.0 ║\n" + + "║ OGC: scale_factor │ │ │ │ ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + + "║ EPSG: False easting (8806) │ Double │ Optional │ (-∞ … ∞) m │ 5000.0 m ║\n" + + "║ OGC: false_easting │ │ │ │ ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼───────────────╢\n" + + "║ EPSG: False northing (8807) │ Double │ Optional │ (-∞ … ∞) m │ 10000.0 m ║\n" + + "║ OGC: false_northing │ │ │ │ ║\n" + + "╚═════════════════════════════════════════════╧════════╧════════════╧═══════════════╧═══════════════╝\n", text); } /** @@ -219,21 +236,21 @@ public final strictfp class ParameterFor "EPSG: Mercator (variant A) (9804)\n" + "EPSG: Mercator (1SP)\n" + "OGC: Mercator_1SP\n" + - "╔══════════════════════════════════════╤════════╤════════════╤═══════════════╤══════════╗\n" + - "║ Name │ Type │ Obligation │ Value domain │ Value ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + - "║ EPSG: Latitude of natural origin │ Double │ Mandatory │ [-80 … 84]° │ 20.0° ║\n" + - "║ OGC: latitude_of_origin │ │ │ │ ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + - "║ EPSG: Longitude of natural origin │ Double │ Mandatory │ [-180 … 180]° │ -60.0° ║\n" + - "║ OGC: central_meridian │ │ │ │ ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + - "║ EPSG: Scale factor at natural origin │ Double │ Mandatory │ (0 … ∞) │ 0.997 ║\n" + - "║ OGC: scale_factor │ │ │ │ ║\n" + - "╟──────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + - "║ EPSG: False northing │ Double │ Optional │ (-∞ … ∞) m │ 20.0 km ║\n" + - "║ OGC: false_northing │ │ │ │ ║\n" + - "╚══════════════════════════════════════╧════════╧════════════╧═══════════════╧══════════╝\n", text); + "╔═════════════════════════════════════════════╤════════╤════════════╤═══════════════╤══════════╗\n" + + "║ Name │ Type │ Obligation │ Value domain │ Value ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + + "║ EPSG: Latitude of natural origin (8801) │ Double │ Mandatory │ [-80 … 84]° │ 20.0° ║\n" + + "║ OGC: latitude_of_origin │ │ │ │ ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + + "║ EPSG: Longitude of natural origin (8802) │ Double │ Mandatory │ [-180 … 180]° │ -60.0° ║\n" + + "║ OGC: central_meridian │ │ │ │ ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + + "║ EPSG: Scale factor at natural origin (8805) │ Double │ Mandatory │ (0 … ∞) │ 0.997 ║\n" + + "║ OGC: scale_factor │ │ │ │ ║\n" + + "╟─────────────────────────────────────────────┼────────┼────────────┼───────────────┼──────────╢\n" + + "║ EPSG: False northing (8807) │ Double │ Optional │ (-∞ … ∞) m │ 20.0 km ║\n" + + "║ OGC: false_northing │ │ │ │ ║\n" + + "╚═════════════════════════════════════════════╧════════╧════════════╧═══════════════╧══════════╝\n", text); } /** @@ -254,15 +271,15 @@ public final strictfp class ParameterFor text = format.format(parameters.toArray(new IdentifiedObject[parameters.size()])); assertMultilinesEquals( - "┌────────────────────────────────┬────────────────────┐\n" + - "│ EPSG │ OGC │\n" + - "├────────────────────────────────┼────────────────────┤\n" + - "│ Latitude of natural origin │ latitude_of_origin │\n" + - "│ Longitude of natural origin │ central_meridian │\n" + - "│ Scale factor at natural origin │ scale_factor │\n" + - "│ False easting │ false_easting │\n" + - "│ False northing │ false_northing │\n" + - "└────────────────────────────────┴────────────────────┘\n", text); + "┌────────────┬────────────────────────────────┬────────────────────┐\n" + + "│ Identifier │ EPSG │ OGC │\n" + + "├────────────┼────────────────────────────────┼────────────────────┤\n" + + "│ EPSG:8801 │ Latitude of natural origin │ latitude_of_origin │\n" + + "│ EPSG:8802 │ Longitude of natural origin │ central_meridian │\n" + + "│ EPSG:8805 │ Scale factor at natural origin │ scale_factor │\n" + + "│ EPSG:8806 │ False easting │ false_easting │\n" + + "│ EPSG:8807 │ False northing │ false_northing │\n" + + "└────────────┴────────────────────────────────┴────────────────────┘\n", text); } /** Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -70,6 +70,7 @@ import org.junit.BeforeClass; org.apache.sis.parameter.MatrixParametersAlphaNumTest.class, org.apache.sis.parameter.TensorValuesTest.class, org.apache.sis.parameter.MapProjectionParametersTest.class, + org.apache.sis.parameter.ParameterMarshallingTest.class, // Test transforms other than map projections. org.apache.sis.referencing.operation.transform.CoordinateDomainTest.class, Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -29,6 +29,7 @@ import org.apache.sis.util.logging.Warni import org.apache.sis.util.resources.Errors; import org.apache.sis.util.resources.Messages; import org.apache.sis.util.resources.IndexedResourceBundle; +import org.apache.sis.internal.jaxb.gco.PropertyType; import org.apache.sis.internal.system.Semaphores; import org.apache.sis.internal.system.Loggers; import org.apache.sis.xml.MarshalContext; @@ -37,16 +38,12 @@ import org.apache.sis.xml.ReferenceResol /** - * Thread-local status of a marshalling or unmarshalling processes, also occasionally used for other processes. + * Thread-local status of a marshalling or unmarshalling processes. * All non-static methods in this class except {@link #finish()} are implementation of public API. * All static methods are internal API. Those methods expect a {@code Context} instance as their first argument. * They should be though as if they were normal member methods, except that they accept {@code null} instance * if no (un)marshalling is in progress. * - * <p>While this class is primarily used for (un)marshalling processes, it may also be opportunistically used - * for other processes like {@link org.apache.sis.metadata.AbstractMetadata#equals(Object)}. The class name is - * only "{@code Context}" for that reason.</p> - * * @author Martin Desruisseaux (Geomatys) * @since 0.3 * @version 0.5 @@ -120,34 +117,46 @@ public final class Context extends Marsh * The timezone, or {@code null} if unspecified. * In the later case, an implementation-default (typically UTC) timezone is used. */ - private TimeZone timezone; + private final TimeZone timezone; /** * The base URL of ISO 19139 (or other standards) schemas. The valid values * are documented in the {@link org.apache.sis.xml.XML#SCHEMAS} property. */ - private Map<String,String> schemas; + private final Map<String,String> schemas; /** * The GML version to be marshalled or unmarshalled, or {@code null} if unspecified. * If null, than the latest version is assumed. */ - private Version versionGML; + private final Version versionGML; /** * The reference resolver currently in use, or {@code null} for {@link ReferenceResolver#DEFAULT}. */ - private ReferenceResolver resolver; + private final ReferenceResolver resolver; /** * The value converter currently in use, or {@code null} for {@link ValueConverter#DEFAULT}. */ - private ValueConverter converter; + private final ValueConverter converter; /** * The object to inform about warnings, or {@code null} if none. */ - private WarningListener<?> warningListener; + private final WarningListener<?> warningListener; + + /** + * The {@code <gml:*PropertyType>} which is wrapping the {@code <gml:*Type>} object to (un)marshal, or + * {@code null} if this information is not provided. See {@link #getWrapper(Context)} for an example. + * + * <p>For performance reasons, this {@code wrapper} information is not provided by default. + * See {@link #setWrapper(Context, PropertyType)} for more information.</p> + * + * @see #getWrapper(Context) + * @see #setWrapper(Context, PropertyType) + */ + private PropertyType<?,?> wrapper; /** * The context which was previously used. This form a linked list allowing to push properties @@ -177,6 +186,7 @@ public final class Context extends Marsh * @param converter The converter in use. * @param warningListener The object to inform about warnings. */ + @SuppressWarnings("ThisEscapedInObjectConstruction") public Context(final int bitMasks, final Locale locale, final TimeZone timezone, final Map<String,String> schemas, final Version versionGML, @@ -191,13 +201,13 @@ public final class Context extends Marsh this.resolver = resolver; this.converter = converter; this.warningListener = warningListener; - previous = current(); - CURRENT.set(this); if ((bitMasks & MARSHALLING) != 0) { if (!Semaphores.queryAndSet(Semaphores.NULL_COLLECTION)) { this.bitMasks |= CLEAR_SEMAPHORE; } } + previous = current(); + CURRENT.set(this); } /** @@ -207,16 +217,24 @@ public final class Context extends Marsh * * @see #push(Locale) */ + @SuppressWarnings("ThisEscapedInObjectConstruction") private Context(final Context previous) { if (previous != null) { - bitMasks = previous.bitMasks; - locale = previous.locale; - timezone = previous.timezone; - schemas = previous.schemas; - versionGML = previous.versionGML; - resolver = previous.resolver; - converter = previous.converter; - warningListener = previous.warningListener; + bitMasks = previous.bitMasks; + locale = previous.locale; + timezone = previous.timezone; + schemas = previous.schemas; + versionGML = previous.versionGML; + resolver = previous.resolver; + converter = previous.converter; + warningListener = previous.warningListener; + } else { + timezone = null; + schemas = null; + versionGML = null; + resolver = null; + converter = null; + warningListener = null; } this.previous = previous; CURRENT.set(this); @@ -320,6 +338,57 @@ public final class Context extends Marsh } /** + * Returns the {@code <gml:*PropertyType>} which is wrapping the {@code <gml:*Type>} object to (un)marshal, + * or {@code null} if this information is not provided. The {@code <gml:*PropertyType>} element can contains + * information not found in {@code <gml:*Type>} objects like XLink or UUID. + * + * <div class="note"><b>Example:</b> + * before unmarshalling the {@code <gml:OperationParameter>} (upper case {@code O}) element below, + * {@code wrapper} will be set to the temporary object representing {@code <gml:operationParameter>}. + * That adapter provides important information for the SIS {@code <gml:OperationParameter>} constructor. + * + * {@preformat xml + * <gml:ParameterValue> + * <gml:valueFile>http://www.opengis.org</gml:valueFile> + * <gml:operationParameter> + * <gml:OperationParameter> + * <gml:name>A parameter of type URI</gml:name> + * </gml:OperationParameter> + * </gml:operationParameter> + * </gml:ParameterValue> + * }</div> + * + * For performance reasons, this {@code wrapper} information is not provided by default. + * See {@link #setWrapper(Context, PropertyType)} for more information. + * + * @param context The current context, or {@code null} if none. + * @return The {@code <gml:*PropertyType>} which is wrapping the {@code <gml:*Type>} object to (un)marshal, + * or {@code null} if unknown. + */ + public static PropertyType<?,?> getWrapper(final Context context) { + return (context != null) ? context.wrapper : null; + } + + /** + * Invoked by {@link PropertyType} implementations for declaring the {@code <gml:*PropertyType>} + * instance which is wrapping the {@code <gml:*Type>} object to (un)marshal. + * + * <p>For performance reasons, this {@code wrapper} information is not provided by default. + * To get this information, the {@code PropertyType} implementation needs to define the + * {@code beforeUnmarshal(…)} method. For an implementation example, see + * {@link org.apache.sis.internal.jaxb.referencing.CC_OperationParameter}.</p> + * + * @param context The current context, or {@code null} if none. + * @param wrapper The {@code <gml:*PropertyType>} which is wrapping the {@code <gml:*Type>} object to (un)marshal, + * or {@code null} if unknown. + */ + public static void setWrapper(final Context context, final PropertyType<?,?> wrapper) { + if (context != null) { + context.wrapper = wrapper; + } + } + + /** * Returns {@code true} if the GML version is equals or newer than the specified version. * If no GML version were specified, then this method returns {@code true}, i.e. newest * version is assumed. Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Distance.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Distance.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Distance.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Distance.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -19,6 +19,7 @@ package org.apache.sis.internal.jaxb.gco import javax.measure.unit.SI; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.adapters.XmlAdapter; +import org.apache.sis.internal.jaxb.gml.Measure; /** Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Measure.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -19,6 +19,7 @@ package org.apache.sis.internal.jaxb.gco import javax.measure.unit.SI; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.adapters.XmlAdapter; +import org.apache.sis.internal.jaxb.gml.Measure; /** Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -50,7 +50,7 @@ import org.apache.sis.util.iso.SimpleInt * </CI_ResponsibleParty> * } * - * The {@code </CI_Contact>} level is not really necessary, and JAXB is not designed for inserting + * The {@code <CI_Contact>} level is not really necessary, and JAXB is not designed for inserting * such level since it is not the usual way to write XML. In order to get this output with JAXB, * we have to wrap metadata object in an additional object. So each {@code PropertyType} subclass * is both a JAXB adapter and a wrapper. We have merged those functionalities in order to avoid Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/UnitAdapter.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -19,6 +19,7 @@ package org.apache.sis.internal.jaxb.gco import javax.measure.unit.Unit; import javax.xml.bind.annotation.adapters.XmlAdapter; import org.apache.sis.internal.jaxb.Context; +import org.apache.sis.internal.jaxb.gml.Measure; import org.apache.sis.internal.util.PatchedUnitFormat; Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -76,6 +76,7 @@ public final class Utilities extends Sta final String text, final String accepted, final boolean toLowerCase) { boolean added = false; + boolean toUpperCase = false; if (text != null) { for (int i=0; i<text.length();) { final int c = text.codePointAt(i); @@ -86,8 +87,12 @@ public final class Utilities extends Sta if (!isFirst && !added && separator != 0) { appendTo.append(separator); } - appendTo.appendCodePoint(toLowerCase ? Character.toLowerCase(c) : c); + appendTo.appendCodePoint(toLowerCase ? Character.toLowerCase(c) : + toUpperCase ? Character.toUpperCase(c) : c); added = true; + toUpperCase = false; + } else { + toUpperCase = true; } i += Character.charCount(c); } Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -208,7 +208,7 @@ public class NumberRange<E extends Numbe if (Float.isNaN(value)) { throw new IllegalArgumentException(Errors.format(Errors.Keys.NotANumber_1, name)); } - return (value != infinity) ? Float.valueOf(value) : null; + return (value != infinity) ? value : null; } /** Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1697309&r1=1697308&r2=1697309&view=diff ============================================================================== --- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original) +++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Mon Aug 24 03:33:52 2015 @@ -141,10 +141,10 @@ import org.junit.BeforeClass; org.apache.sis.internal.jaxb.IdentifierMapAdapterTest.class, org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCasesTest.class, org.apache.sis.internal.jaxb.gco.StringAdapterTest.class, - org.apache.sis.internal.jaxb.gco.MeasureTest.class, org.apache.sis.internal.jaxb.gco.PropertyTypeTest.class, org.apache.sis.internal.jaxb.gmd.LanguageCodeTest.class, org.apache.sis.internal.jaxb.gml.TimePeriodTest.class, + org.apache.sis.internal.jaxb.gml.MeasureTest.class, org.apache.sis.util.iso.NameMarshallingTest.class }) public final strictfp class UtilityTestSuite extends TestSuite {
