Author: desruisseaux
Date: Fri Sep 4 11:28:03 2015
New Revision: 1701219
URL: http://svn.apache.org/r1701219
Log:
More straightfoward checks for duplicated property assignations.
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -265,9 +265,9 @@ public final class ReferencingUtilities
}
/**
- * Ensures that the given argument value is {@code false}. This method is
invoked by private setter methods,
- * which are themselves invoked by JAXB at unmarshalling time. Invoking
this method from those setter methods
- * serves three purposes:
+ * Invoked by private setter methods (themselves invoked by JAXB at
unmarshalling time)
+ * when an element is already set. Invoking this method from those setter
methods serves
+ * three purposes:
*
* <ul>
* <li>Make sure that a singleton property is not defined twice in the
XML document.</li>
@@ -277,23 +277,17 @@ public final class ReferencingUtilities
* warning or error messages in future SIS versions.</li>
* </ul>
*
- * @param classe The caller class, used only in case of warning
message to log.
- * @param method The caller method, used only in case of warning
message to log.
- * @param name The property name, used only in case of error message
to format.
- * @param isDefined Whether the property in the caller object is current
defined.
- * @return {@code true} if the caller can set the property.
+ * @param classe The caller class, used only in case of warning message
to log.
+ * @param method The caller method, used only in case of warning message
to log.
+ * @param name The property name, used only in case of error message to
format.
* @throws IllegalStateException If {@code isDefined} is {@code true} and
we are not unmarshalling an object.
*/
- public static boolean canSetProperty(final Class<?> classe, final String
method,
- final String name, final boolean isDefined) throws
IllegalStateException
+ public static void propertyAlreadySet(final Class<?> classe, final String
method, final String name)
+ throws IllegalStateException
{
- if (!isDefined) {
- return true;
- }
final Context context = Context.current();
if (context != null) {
Context.warningOccured(context, classe, method, Errors.class,
Errors.Keys.ElementAlreadyPresent_1, name);
- return false;
} else {
throw new
IllegalStateException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, name));
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -436,11 +436,11 @@ public class DefaultParameterDescriptorG
* Invoked by JAXB for setting the unmarshalled parameter descriptors.
*/
private void setDescriptors(final GeneralParameterDescriptor[] parameters)
{
- if (ReferencingUtilities.canSetProperty(DefaultParameterValue.class,
- "setDescriptors", "parameter", !descriptors.isEmpty()))
- {
+ if (descriptors.isEmpty()) {
verifyNames(null, parameters);
descriptors = asList(parameters);
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultParameterValue.class,
"setDescriptors", "parameter");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -1052,9 +1052,7 @@ public class DefaultParameterValue<T> ex
*/
@SuppressWarnings("unchecked")
private void setXmlValue(Object xmlValue) {
- if (ReferencingUtilities.canSetProperty(DefaultParameterValue.class,
- "setXmlValue", "value", value != null || unit != null))
- {
+ if (value == null && unit == null) {
if (xmlValue instanceof Measure) {
final Measure measure = (Measure) xmlValue;
xmlValue = measure.value;
@@ -1085,6 +1083,8 @@ public class DefaultParameterValue<T> ex
*/
value = (T) xmlValue;
}
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultParameterValue.class,
"setXmlValue", "value");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -582,10 +582,10 @@ public class DefaultParameterValueGroup
* @see #getDescriptor()
*/
private void setDescriptor(final ParameterDescriptorGroup descriptor) {
- if (ReferencingUtilities.canSetProperty(DefaultParameterValue.class,
- "setDescriptor", "group", values != null))
- {
+ if (values == null) {
values = new ParameterValueList(descriptor);
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultParameterValue.class,
"setDescriptor", "group");
}
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -554,13 +554,15 @@ public class AbstractIdentifiedObject ex
* Invoked by JAXB at unmarshalling time for setting the identifier.
*/
private void setIdentifier(final Code identifier) {
- if (identifier != null) {
- final Identifier id = identifier.getIdentifier();
- if (id != null &&
ReferencingUtilities.canSetProperty(AbstractIdentifiedObject.class,
- "setIdentifier", "identifier", identifiers != null))
- {
- identifiers = Collections.singleton(id);
+ if (identifiers == null) {
+ if (identifier != null) {
+ final Identifier id = identifier.getIdentifier();
+ if (id != null) {
+ identifiers = Collections.singleton(id);
+ }
}
+ } else {
+
ReferencingUtilities.propertyAlreadySet(AbstractIdentifiedObject.class,
"setIdentifier", "identifier");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractCRS.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -323,10 +323,10 @@ public class AbstractCRS extends Abstrac
* @throws IllegalStateException If the coordinate system has already been
set.
*/
final void setCoordinateSystem(final String name, final CoordinateSystem
cs) {
- if (cs != null &&
ReferencingUtilities.canSetProperty(AbstractCRS.class,
- "setCoordinateSystem", name, coordinateSystem != null))
- {
+ if (coordinateSystem == null) {
coordinateSystem = cs;
+ } else {
+ ReferencingUtilities.propertyAlreadySet(AbstractCRS.class,
"setCoordinateSystem", name);
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -463,15 +463,15 @@ public class DefaultCoordinateSystemAxis
* 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))
- {
+ 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");
}
}
@@ -499,15 +499,15 @@ public class DefaultCoordinateSystemAxis
* 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))
- {
+ 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/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -33,10 +33,10 @@ import org.apache.sis.util.iso.Types;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.internal.util.Citations;
import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
import static org.apache.sis.util.Utilities.deepEquals;
import static org.apache.sis.util.collection.Containers.property;
-import static
org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
// Branch-dependent imports
import java.util.Objects;
@@ -306,10 +306,10 @@ public class AbstractDatum extends Abstr
* Invoked by JAXB only at unmarshalling time.
*/
private void setRealizationEpoch(final Date value) {
- if (value != null && canSetProperty(AbstractDatum.class,
- "setRealizationEpoch", "realizationEpoch", realizationEpoch !=
Long.MIN_VALUE))
- {
+ if (realizationEpoch == Long.MIN_VALUE) {
realizationEpoch = value.getTime();
+ } else {
+ ReferencingUtilities.propertyAlreadySet(AbstractDatum.class,
"setRealizationEpoch", "realizationEpoch");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -266,9 +266,7 @@ public class DefaultPrimeMeridian extend
* Invoked by JAXB for setting the Greenwich longitude and its unit of
measurement.
*/
private void setGreenwichMeasure(final Measure measure) {
- if (measure != null &&
ReferencingUtilities.canSetProperty(DefaultPrimeMeridian.class,
- "setGreenwichMeasure", "greenwichLongitude",
greenwichLongitude != 0 || angularUnit != null))
- {
+ if (greenwichLongitude == 0 && angularUnit == null) {
greenwichLongitude = measure.value;
angularUnit = measure.getUnit(Angle.class);
if (angularUnit == null) {
@@ -283,6 +281,8 @@ public class DefaultPrimeMeridian extend
Measure.missingUOM(DefaultPrimeMeridian.class,
"setGreenwichMeasure");
}
}
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultPrimeMeridian.class,
"setGreenwichMeasure", "greenwichLongitude");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -29,12 +29,12 @@ import org.opengis.referencing.datum.Tem
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.jaxb.gml.UniversalTimeAdapter;
import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.io.wkt.FormattableObject;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static
org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
// Branch-dependent imports
import java.util.Objects;
@@ -233,10 +233,10 @@ public class DefaultTemporalDatum extend
* Invoked by JAXB only at unmarshalling time.
*/
private void setOrigin(final Date value) {
- if (value != null && canSetProperty(DefaultTemporalDatum.class,
- "setOrigin", "origin", origin != Long.MIN_VALUE))
- {
+ if (origin == Long.MIN_VALUE) {
origin = value.getTime();
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultTemporalDatum.class,
"setOrigin", "origin");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -31,9 +31,9 @@ import org.apache.sis.internal.jaxb.Cont
import org.apache.sis.internal.jaxb.LegacyNamespaces;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.metadata.VerticalDatumTypes;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static
org.apache.sis.internal.referencing.ReferencingUtilities.canSetProperty;
// Branch-dependent imports
import java.util.Objects;
@@ -265,8 +265,10 @@ public class DefaultVerticalDatum extend
* Invoked by JAXB only. The vertical datum type is set only if it has not
already been specified.
*/
private void setTypeElement(final VerticalDatumType t) {
- if (t != null && canSetProperty(DefaultVerticalDatum.class,
"setTypeElement", "verticalDatumType", type != null)) {
+ if (type == null) {
type = t;
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultVerticalDatum.class,
"setTypeElement", "verticalDatumType");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -842,11 +842,11 @@ check: for (int isTarget=0; ; isTar
* Invoked by JAXB at marshalling time for setting the source CRS.
*/
private void setSource(final CoordinateReferenceSystem crs) {
- if
(ReferencingUtilities.canSetProperty(AbstractCoordinateOperation.class,
- "setSource", "sourceCRS", sourceCRS != null))
- {
+ if (sourceCRS == null) {
sourceCRS = crs;
afterUnmarshal();
+ } else {
+
ReferencingUtilities.propertyAlreadySet(AbstractCoordinateOperation.class,
"setSource", "sourceCRS");
}
}
@@ -862,11 +862,11 @@ check: for (int isTarget=0; ; isTar
* Invoked by JAXB at marshalling time for setting the target CRS.
*/
private void setTarget(final CoordinateReferenceSystem crs) {
- if
(ReferencingUtilities.canSetProperty(AbstractCoordinateOperation.class,
- "setTarget", "targetCRS", targetCRS != null))
- {
+ if (targetCRS == null) {
targetCRS = crs;
afterUnmarshal();
+ } else {
+
ReferencingUtilities.propertyAlreadySet(AbstractCoordinateOperation.class,
"setTarget", "targetCRS");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -455,9 +455,7 @@ class AbstractSingleOperation extends Ab
* @see DefaultOperationMethod#setDescriptors
*/
private void setParameters(final GeneralParameterValue[] values) {
- if (ReferencingUtilities.canSetProperty(AbstractSingleOperation.class,
- "setParameters", "parameterValue", parameters != null))
- {
+ if (parameters == null) {
/*
* The descriptors in the <gml:method> element do not know the
class of parameter value
* (String, Integer, Double, double[], etc.) because this
information is not part of GML.
@@ -491,6 +489,8 @@ class AbstractSingleOperation extends Ab
parameters = new
DefaultParameterValueGroup(method.getParameters());
CC_OperationMethod.store(values, parameters.values(),
replacements);
afterUnmarshal(); // For creating the math transform.
+ } else {
+
ReferencingUtilities.propertyAlreadySet(AbstractSingleOperation.class,
"setParameters", "parameterValue");
}
}
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1701219&r1=1701218&r2=1701219&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
[UTF-8] Fri Sep 4 11:28:03 2015
@@ -745,11 +745,11 @@ public class DefaultOperationMethod exte
* Invoked by JAXB for setting the citation to the formula.
*/
private void setFormulaCitation(final Citation citation) {
- if (ReferencingUtilities.canSetProperty(DefaultOperationMethod.class,
"setFormulaCitation",
- "formulaCitation", formula != null && formula.getCitation() !=
null))
- {
+ if (formula == null || formula.getCitation() == null) {
formula = (formula == null) ? new DefaultFormula(citation)
: new DefaultFormula(formula.getFormula(), citation);
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultOperationMethod.class,
"setFormulaCitation", "formulaCitation");
}
}
@@ -757,11 +757,11 @@ public class DefaultOperationMethod exte
* Invoked by JAXB for setting the formula description.
*/
private void setFormulaDescription(final String description) {
- if (ReferencingUtilities.canSetProperty(DefaultOperationMethod.class,
"setFormulaDescription",
- "formula", formula != null && formula.getFormula() != null))
- {
+ if (formula == null || formula.getFormula() == null) {
formula = (formula == null) ? new DefaultFormula(description)
: new DefaultFormula(new
SimpleInternationalString(description), formula.getCitation());
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultOperationMethod.class,
"setFormulaDescription", "formula");
}
}
@@ -816,10 +816,10 @@ public class DefaultOperationMethod exte
* @see AbstractSingleOperation#setParameters
*/
private void setDescriptors(final GeneralParameterDescriptor[]
descriptors) {
- if (ReferencingUtilities.canSetProperty(DefaultOperationMethod.class,
- "setDescriptors", "parameter", parameters != null))
- {
+ if (parameters == null) {
parameters = CC_OperationMethod.group(super.getName(),
descriptors);
+ } else {
+
ReferencingUtilities.propertyAlreadySet(DefaultOperationMethod.class,
"setDescriptors", "parameter");
}
}