Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Event.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_Event extends Prop
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Event.class}
*/
@Override
protected Class<Event> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Event extends Prop
*/
@XmlElementRef
public DefaultEvent getElement() {
- return skip() ? null : DefaultEvent.castOrCopy(metadata);
+ return DefaultEvent.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GCP.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_GCP extends Proper
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code GCP.class}
*/
@Override
protected Class<GCP> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_GCP extends Proper
*/
@XmlElementRef
public DefaultGCP getElement() {
- return skip() ? null : DefaultGCP.castOrCopy(metadata);
+ return DefaultGCP.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_GeolocationInformation.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -45,6 +45,8 @@ public final class MI_GeolocationInforma
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code GeolocationInformation.class}
*/
@Override
protected Class<GeolocationInformation> getBoundType() {
@@ -79,7 +81,7 @@ public final class MI_GeolocationInforma
*/
@XmlElementRef
public AbstractGeolocationInformation getElement() {
- return skip() ? null : AbstractGeolocationInformation.castOrCopy(metadata);
+ return AbstractGeolocationInformation.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Instrument.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_Instrument extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Instrument.class}
*/
@Override
protected Class<Instrument> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Instrument extends
*/
@XmlElementRef
public DefaultInstrument getElement() {
- return skip() ? null : DefaultInstrument.castOrCopy(metadata);
+ return DefaultInstrument.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Objective.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_Objective extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Objective.class}
*/
@Override
protected Class<Objective> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Objective extends
*/
@XmlElementRef
public DefaultObjective getElement() {
- return skip() ? null : DefaultObjective.castOrCopy(metadata);
+ return DefaultObjective.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Operation.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_Operation extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Operation.class}
*/
@Override
protected Class<Operation> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Operation extends
*/
@XmlElementRef
public DefaultOperation getElement() {
- return skip() ? null : DefaultOperation.castOrCopy(metadata);
+ return DefaultOperation.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Plan.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_Plan extends Prope
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Plan.class}
*/
@Override
protected Class<Plan> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Plan extends Prope
*/
@XmlElementRef
public DefaultPlan getElement() {
- return skip() ? null : DefaultPlan.castOrCopy(metadata);
+ return DefaultPlan.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Platform.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_Platform extends P
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Platform.class}
*/
@Override
protected Class<Platform> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Platform extends P
*/
@XmlElementRef
public DefaultPlatform getElement() {
- return skip() ? null : DefaultPlatform.castOrCopy(metadata);
+ return DefaultPlatform.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_PlatformPass.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_PlatformPass exten
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code PlatformPass.class}
*/
@Override
protected Class<PlatformPass> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_PlatformPass exten
*/
@XmlElementRef
public DefaultPlatformPass getElement() {
- return skip() ? null : DefaultPlatformPass.castOrCopy(metadata);
+ return DefaultPlatformPass.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RangeElementDescription.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -45,6 +45,8 @@ public final class MI_RangeElementDescri
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code RangeElementDescription.class}
*/
@Override
protected Class<RangeElementDescription> getBoundType() {
@@ -79,7 +81,7 @@ public final class MI_RangeElementDescri
*/
@XmlElementRef
public DefaultRangeElementDescription getElement() {
- return skip() ? null : DefaultRangeElementDescription.castOrCopy(metadata);
+ return DefaultRangeElementDescription.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_RequestedDate.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_RequestedDate exte
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code RequestedDate.class}
*/
@Override
protected Class<RequestedDate> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_RequestedDate exte
*/
@XmlElementRef
public DefaultRequestedDate getElement() {
- return skip() ? null : DefaultRequestedDate.castOrCopy(metadata);
+ return DefaultRequestedDate.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MI_Requirement.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MI_Requirement extend
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code Requirement.class}
*/
@Override
protected Class<Requirement> getBoundType() {
@@ -77,7 +79,7 @@ public final class MI_Requirement extend
*/
@XmlElementRef
public DefaultRequirement getElement() {
- return skip() ? null : DefaultRequirement.castOrCopy(metadata);
+ return DefaultRequirement.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -43,6 +43,8 @@ public final class MX_DataFile extends P
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code DataFile.class}
*/
@Override
protected Class<DataFile> getBoundType() {
@@ -77,7 +79,7 @@ public final class MX_DataFile extends P
*/
@XmlElementRef
public DefaultDataFile getElement() {
- return skip() ? null : DefaultDataFile.castOrCopy(metadata);
+ return DefaultDataFile.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -48,6 +48,8 @@ public final class RS_Identifier extends
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code ReferenceIdentifier.class}
*/
@Override
protected Class<ReferenceIdentifier> getBoundType() {
@@ -82,9 +84,10 @@ public final class RS_Identifier extends
*/
@XmlElementRef
public ImmutableIdentifier getElement() {
- if (skip()) return null;
final ReferenceIdentifier metadata = this.metadata;
- if (metadata instanceof ImmutableIdentifier) {
+ if (metadata == null) {
+ return null;
+ } else if (metadata instanceof ImmutableIdentifier) {
return (ImmutableIdentifier) metadata;
} else {
return new ImmutableIdentifier(metadata);
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_ReferenceSystem.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -41,6 +41,8 @@ public final class RS_ReferenceSystem ex
* Returns the GeoAPI interface which is bound by this adapter.
* This method is indirectly invoked by the private constructor
* below, so it shall not depend on the state of this object.
+ *
+ * @return {@code ReferenceSystem.class}
*/
@Override
protected Class<ReferenceSystem> getBoundType() {
@@ -77,9 +79,10 @@ public final class RS_ReferenceSystem ex
*/
@XmlElementRef
public ReferenceSystemMetadata getElement() {
- if (skip()) return null;
final ReferenceSystem metadata = this.metadata;
- if (metadata instanceof ReferenceSystemMetadata) {
+ if (metadata == null) {
+ return null;
+ } else if (metadata instanceof ReferenceSystemMetadata) {
return (ReferenceSystemMetadata) metadata;
} else {
return new ReferenceSystemMetadata(metadata);
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_Ellipsoid.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -79,7 +79,7 @@ public final class CD_Ellipsoid extends
*/
@XmlElement(name = "Ellipsoid")
public DefaultEllipsoid getElement() {
- return skip() ? null : DefaultEllipsoid.castOrCopy(metadata);
+ return DefaultEllipsoid.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_GeodeticDatum.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -79,7 +79,7 @@ public final class CD_GeodeticDatum exte
*/
@XmlElement(name = "GeodeticDatum")
public DefaultGeodeticDatum getElement() {
- return skip() ? null : DefaultGeodeticDatum.castOrCopy(metadata);
+ return DefaultGeodeticDatum.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_ImageDatum.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -79,7 +79,7 @@ public final class CD_ImageDatum extends
*/
@XmlElement(name = "ImageDatum")
public DefaultImageDatum getElement() {
- return skip() ? null : DefaultImageDatum.castOrCopy(metadata);
+ return DefaultImageDatum.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_PrimeMeridian.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -79,7 +79,7 @@ public final class CD_PrimeMeridian exte
*/
@XmlElement(name = "Ellipsoid")
public DefaultPrimeMeridian getElement() {
- return skip() ? null : DefaultPrimeMeridian.castOrCopy(metadata);
+ return DefaultPrimeMeridian.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_TemporalDatum.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -79,7 +79,7 @@ public final class CD_TemporalDatum exte
*/
@XmlElement(name = "TemporalDatum")
public DefaultTemporalDatum getElement() {
- return skip() ? null : DefaultTemporalDatum.castOrCopy(metadata);
+ return DefaultTemporalDatum.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CD_VerticalDatum.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -79,7 +79,7 @@ public final class CD_VerticalDatum exte
*/
@XmlElement(name = "VerticalDatum")
public DefaultVerticalDatum getElement() {
- return skip() ? null : DefaultVerticalDatum.castOrCopy(metadata);
+ return DefaultVerticalDatum.castOrCopy(metadata);
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Boolean.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -49,6 +49,8 @@ public final class GO_Boolean extends Pr
/**
* Returns the Java type which is bound by this adapter.
+ *
+ * @return {@code Boolean.class}
*/
@Override
protected Class<Boolean> getBoundType() {
@@ -75,7 +77,7 @@ public final class GO_Boolean extends Pr
*/
@XmlElement(name = "Boolean")
public Boolean getElement() {
- return skip() ? null : metadata;
+ return metadata;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -269,6 +269,8 @@ public class GO_CharacterString {
* {@note Returning <code>null</code> is unusual and not a recommended practice.
* But precedents exist (for example Swing <code>DefaultMutableTreeNode</code>)
* and this class is not for public usage.}
+ *
+ * @return The text as a string (may be null).
*/
@Override
public final String toString() {
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -58,6 +58,8 @@ public final class GO_Decimal extends Pr
/**
* Returns the Java type which is bound by this adapter.
+ *
+ * @return {@code Double.class}
*/
@Override
protected Class<Double> getBoundType() {
@@ -84,7 +86,7 @@ public final class GO_Decimal extends Pr
*/
@XmlElement(name = "Decimal")
public Double getElement() {
- return skip() ? null : metadata;
+ return metadata;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Decimal32.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -48,6 +48,8 @@ public final class GO_Decimal32 extends
/**
* Returns the Java type which is bound by this adapter.
+ *
+ * @return {@code Float.class}
*/
@Override
protected Class<Float> getBoundType() {
@@ -74,7 +76,7 @@ public final class GO_Decimal32 extends
*/
@XmlElement(name = "Decimal")
public Float getElement() {
- return skip() ? null : metadata;
+ return metadata;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -51,6 +51,8 @@ public final class GO_Integer extends Pr
/**
* Returns the Java type which is bound by this adapter.
+ *
+ * @return {@code Integer.class}
*/
@Override
protected Class<Integer> getBoundType() {
@@ -77,7 +79,7 @@ public final class GO_Integer extends Pr
*/
@XmlElement(name = "Integer")
public Integer getElement() {
- return skip() ? null : metadata;
+ return metadata;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Integer64.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -48,6 +48,8 @@ public final class GO_Integer64 extends
/**
* Returns the Java type which is bound by this adapter.
+ *
+ * @return {@code Long.class}
*/
@Override
protected Class<Long> getBoundType() {
@@ -74,7 +76,7 @@ public final class GO_Integer64 extends
*/
@XmlElement(name = "Integer")
public Long getElement() {
- return skip() ? null : metadata;
+ return metadata;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_Real.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -53,6 +53,8 @@ public final class GO_Real extends Prope
/**
* Returns the Java type which is bound by this adapter.
+ *
+ * @return {@code Double.class}
*/
@Override
protected Class<Double> getBoundType() {
@@ -79,7 +81,7 @@ public final class GO_Real extends Prope
*/
@XmlElement(name = "Real")
public Double getElement() {
- return skip() ? null : metadata;
+ return metadata;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_RecordType.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -59,6 +59,8 @@ public final class GO_RecordType extends
/**
* Returns the GeoAPI interface which is bound by this adapter.
+ *
+ * @return {@code RecordType.class}
*/
@Override
protected Class<RecordType> getBoundType() {
@@ -73,7 +75,7 @@ public final class GO_RecordType extends
*/
@XmlElement(name = "RecordType")
public DefaultRecordType getElement() {
- return skip() ? null : DefaultRecordType.castOrCopy(metadata);
+ return DefaultRecordType.castOrCopy(metadata);
}
/**
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=1550306&r1=1550305&r2=1550306&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] Wed Dec 11 23:08:32 2013
@@ -105,7 +105,7 @@ import org.apache.sis.util.iso.SimpleInt
* @author Cédric Briançon (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.4
* @module
*
* @see XmlAdapter
@@ -114,7 +114,8 @@ public abstract class PropertyType<Value
extends XmlAdapter<ValueType,BoundType>
{
/**
- * The wrapped GeoAPI metadata instance.
+ * The wrapped GeoAPI metadata instance, or {@code null} if the metadata shall not be marshalled.
+ * Metadata are not marshalled when replaced by {@code xlink:href} or {@code uuidref} attributes.
*/
protected BoundType metadata;
@@ -140,8 +141,8 @@ public abstract class PropertyType<Value
}
/**
- * Builds an adapter for the given primitive wrapper. This constructor checks for nil reasons
- * only if {@code check} is {@code true}.
+ * Builds a {@code PropertyType} wrapper for the given primitive type wrapper.
+ * This constructor checks for nil reasons only if {@code check} is {@code true}.
*
* @param value The primitive type wrapper.
* @param mayBeNil {@code true} if we should check for nil reasons.
@@ -152,31 +153,33 @@ public abstract class PropertyType<Value
final Object property = PrimitiveTypeProperties.property(value);
if (property instanceof NilReason) {
reference = property.toString();
+ metadata = null;
}
}
}
/**
- * Builds an adapter for the given GeoAPI interface. This constructor checks if the given metadata
+ * Builds a wrapper for the given GeoAPI interface. This constructor checks if the given metadata
* implements the {@link NilObject} or {@link IdentifiedObject} interface. If the object implements
* both of them (should not happen, but we never know), then the identifiers will have precedence.
*
- * @param metadata The interface to wrap.
+ * @param value The interface to wrap.
*/
- protected PropertyType(final BoundType metadata) {
- this.metadata = metadata;
+ protected PropertyType(final BoundType value) {
+ metadata = value;
/*
* Do not invoke NilReason.forObject(metadata) in order to avoid unnecessary synchronization.
* Subclasses will use the PropertyType(BoundType, boolean) constructor instead when a check
* for primitive type is required.
*/
- if (metadata instanceof NilObject) {
- final NilReason reason = ((NilObject) metadata).getNilReason();
+ if (value instanceof NilObject) {
+ final NilReason reason = ((NilObject) value).getNilReason();
if (reason != null) {
reference = reason.toString();
+ metadata = null;
}
}
- if (metadata instanceof IdentifiedObject) {
+ if (value instanceof IdentifiedObject) {
/*
* Get the identifiers as full UUID or XLink objects. We do not use the more permissive methods
* working with arbitrary strings -- e.g. map.get(IdentifierSpace.HREF) -- because we are going
@@ -197,7 +200,7 @@ public abstract class PropertyType<Value
* We do not try to parse UUID or XLink objects from String because it should be the job of
* org.apache.sis.internal.jaxb.IdentifierMapWithSpecialCases.put(Citation, String).
*/
- final IdentifierMap map = ((IdentifiedObject) metadata).getIdentifierMap();
+ final IdentifierMap map = ((IdentifiedObject) value).getIdentifierMap();
XLink link = map.getSpecialized(IdentifierSpace.XLINK);
UUID uuid = map.getSpecialized(IdentifierSpace.UUID);
if (uuid != null || link != null) {
@@ -209,11 +212,20 @@ public abstract class PropertyType<Value
* If not, forget them in order to avoid marshalling the identifiers twice (see the
* example in the above comment).
*/
- if (uuid != null && !resolver.canSubstituteByReference(context, type, metadata, uuid)) {
- uuid = null;
+ if (uuid != null) {
+ if (resolver.canSubstituteByReference(context, type, value, uuid)) {
+ metadata = null;
+ } else {
+ uuid = null;
+ }
}
- if (link != null && !resolver.canSubstituteByReference(context, type, metadata, link)) {
- link = null;
+ /*
+ * There is no risk of duplication for 'xlink' because there is no such attribute in ISOMetadata.
+ * So if the user does not allow us to omit the metadata object, we will still keep the xlink for
+ * informative purpose.
+ */
+ if (link != null && resolver.canSubstituteByReference(context, type, value, link)) {
+ metadata = null;
}
if (uuid != null || link != null) {
reference = new ObjectReference(uuid, link);
@@ -287,18 +299,6 @@ public abstract class PropertyType<Value
}
/**
- * Returns {@code true} if the wrapped metadata should not be marshalled. It may be because
- * a non-null "{@code uuidref}" attribute has been specified (in which case the UUID reference
- * will be marshalled in place of the full metadata), or any other reason that may be added in
- * future implementations.
- *
- * @return {@code true} if the wrapped metadata should not be marshalled.
- */
- protected final boolean skip() {
- return reference != null;
- }
-
- /**
* A URN to an external resources, or to an other part of a XML document, or an identifier.
* The {@code uuidref} attribute is used to refer to an XML element that has a corresponding
* {@code uuid} attribute.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -60,7 +60,7 @@ public class ReferenceResolver {
*
* <ul>
* <li>Implements the given {@code type} interface.</li>
- * <li>Implements the {@link IdentifiedObject} interface.</li>
+ * <li>Implements the {@link NilObject} and {@link IdentifiedObject} interfaces from this package.</li>
* <li>{@link IdentifiedObject#getIdentifiers()} will return the given identifiers.</li>
* <li>{@link IdentifiedObject#getIdentifierMap()} will return a {@link java.util.Map}
* view over the given identifiers.</li>
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/PropertyTypeTest.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -56,14 +56,18 @@ public final strictfp class PropertyType
}
/**
- * Creates a dummy XLink.
+ * Asserts that the given property has the given UUID value, which may be null.
+ * All other properties are expected to be null for this test.
*/
- private static XLink createXLink() {
- final XLink link = new XLink();
- link.setShow(XLink.Show.REPLACE);
- link.setActuate(XLink.Actuate.ON_LOAD);
- link.setTitle(new SimpleInternationalString("myResult"));
- return link;
+ private static void assertReferenceEqualsUUID(final String uuidref, final PropertyType<?,?> property) {
+ assertNull ("nilReason", property.getNilReason());
+ assertEquals("uuidref", uuidref, property.getUUIDREF());
+ assertNull ("href", property.getHRef());
+ assertNull ("role", property.getRole());
+ assertNull ("arcrole", property.getArcRole());
+ assertNull ("title", property.getTitle());
+ assertNull ("show", property.getShow());
+ assertNull ("actuate", property.getActuate());
}
/**
@@ -75,69 +79,79 @@ public final strictfp class PropertyType
public void testWithNoReference() throws Exception {
final PropertyTypeMock property = marshal();
assertSame(metadata, property.metadata);
- assertNoReference(property);
+ assertReferenceEqualsUUID(null, property);
}
/**
- * Asserts that the given property has no UUID, XLink or other references.
- */
- private static void assertNoReference(final PropertyType<?,?> property) {
- assertNull ("nilReason", property.getNilReason());
- assertNull ("uuidref", property.getUUIDREF());
- assertNull ("href", property.getHRef());
- assertNull ("role", property.getRole());
- assertNull ("arcrole", property.getArcRole());
- assertNull ("title", property.getTitle());
- assertNull ("show", property.getShow());
- assertNull ("actuate", property.getActuate());
- assertFalse("skip", property.skip());
- }
-
- /**
- * Tests the construction of an object containing {@code UUID} and {@code XLink} references,
- * but in a context where the user didn't gave us the authorization to use them.
+ * Tests the construction of an object containing {@code UUID} reference,
+ * but in a context where the user didn't gave us the authorization to use it.
*
* @throws Exception Should never happen.
*/
@Test
- @DependsOnMethod({"testWithUUID", "testWithXLink"})
- public void testWithDiscardedReferences() throws Exception {
- final UUID uuid = UUID.randomUUID();
- final XLink link = createXLink();
- metadata.getIdentifierMap().putSpecialized(IdentifierSpace.UUID, uuid);
- metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
- final PropertyTypeMock property = marshal();
- assertSame(metadata, property.metadata);
- assertNoReference(property);
+ @DependsOnMethod("testWithUUID")
+ public void testWithDiscardedUUID() throws Exception {
+ testWithUUID(false);
}
/**
* Tests the construction of an object containing a {@link UUID}.
- * The {@code XLink} is allowed to replace the object definition in the XML to be marshalled.
+ * The {@code UUID} is allowed to replace the object definition in the XML to be marshalled.
*
* @throws Exception Should never happen.
*/
@Test
@DependsOnMethod("testWithNoReference")
public void testWithUUID() throws Exception {
+ testWithUUID(true);
+ }
+
+ /**
+ * Implementation of the public {@code test*UUID()} methods.
+ *
+ * <ul>
+ * <li>If {@code useReferenceResolverMock} is {@code false}, then this test behaves like
+ * {@link #testWithNoReference()} because the default SIS behavior is to not replace
+ * XML elements by their {@code uuidref} attributes, since SIS does not know if the
+ * client who is going to read the XML file will be able to find object definitions
+ * from their UUID.</li>
+ *
+ * <li>If {@code useReferenceResolverMock} is {@code true}, then the metadata object shall be replaced
+ * by the UUID because the {@link ReferenceResolverMock#canSubstituteByReference(MarshalContext,
+ * Class, Object, UUID)} method returns {@code true}.</li>
+ * </ul>
+ */
+ private void testWithUUID(final boolean useReferenceResolverMock) throws Exception {
final UUID uuid = UUID.randomUUID();
metadata.getIdentifierMap().putSpecialized(IdentifierSpace.UUID, uuid);
- context = ReferenceResolverMock.begin(true);
+ if (useReferenceResolverMock) {
+ context = ReferenceResolverMock.begin(true);
+ // XMLTestCase.clearContext() will dispose the context.
+ }
final PropertyTypeMock property = marshal();
- assertSame (metadata, property.metadata);
- assertNull ("nilReason", property.getNilReason());
- assertEquals(uuid.toString(), property.getUUIDREF());
- assertNull ("href", property.getHRef());
- assertNull ("role", property.getRole());
- assertNull ("arcrole", property.getArcRole());
- assertNull ("title", property.getTitle());
- assertNull ("show", property.getShow());
- assertNull ("actuate", property.getActuate());
- assertTrue ("skip", property.skip());
+ if (!useReferenceResolverMock) {
+ assertSame(metadata, property.metadata);
+ assertReferenceEqualsUUID(null, property);
+ } else {
+ assertNull("metadata", property.metadata);
+ assertReferenceEqualsUUID(uuid.toString(), property);
+ }
}
/**
- * Tests the construction of an object containing a {@link XLink}.
+ * Tests the construction of an object containing a {@link XLink} while keeping the metadata.
+ * The {@code XLink} is provided for information purpose.
+ *
+ * @throws Exception Should never happen.
+ */
+ @Test
+ @DependsOnMethod("testWithXLink")
+ public void testWithInformativeXLink() throws Exception {
+ testWithXLink(false);
+ }
+
+ /**
+ * Tests the construction of an object containing a {@link XLink} replacing the metadata.
* The {@code XLink} is allowed to replace the object definition in the XML to be marshalled.
*
* @throws Exception Should never happen.
@@ -145,19 +159,44 @@ public final strictfp class PropertyType
@Test
@DependsOnMethod("testWithNoReference")
public void testWithXLink() throws Exception {
- final XLink link = createXLink();
+ testWithXLink(true);
+ }
+
+ /**
+ * Implementation of the public {@code test*XLink()} methods.
+ *
+ * <ul>
+ * <li>If {@code useReferenceResolverMock} is {@code false}, then this test uses the default SIS behavior,
+ * which is to not omit the metadata and still write the XLink for informative purpose.</li>
+ *
+ * <li>If {@code useReferenceResolverMock} is {@code true}, then the metadata object shall be replaced
+ * by the XLink because the {@link ReferenceResolverMock#canSubstituteByReference(MarshalContext,
+ * Class, Object, Xlink)} method returns {@code true}.</li>
+ * </ul>
+ */
+ private void testWithXLink(final boolean useReferenceResolverMock) {
+ final XLink link = new XLink();
+ link.setShow(XLink.Show.REPLACE);
+ link.setActuate(XLink.Actuate.ON_LOAD);
+ link.setTitle(new SimpleInternationalString("myLinkTitle"));
metadata.getIdentifierMap().putSpecialized(IdentifierSpace.XLINK, link);
- context = ReferenceResolverMock.begin(true);
+ if (useReferenceResolverMock) {
+ context = ReferenceResolverMock.begin(true);
+ // XMLTestCase.clearContext() will dispose the context.
+ }
final PropertyTypeMock property = marshal();
- assertSame (metadata, property.metadata);
- assertNull ("nilReason", property.getNilReason());
- assertNull ("uuidref", property.getUUIDREF());
- assertNull ("href", property.getHRef());
- assertNull ("role", property.getRole());
- assertNull ("arcrole", property.getArcRole());
- assertEquals("myResult", property.getTitle());
- assertEquals(XLink.Show.REPLACE, property.getShow());
- assertEquals(XLink.Actuate.ON_LOAD, property.getActuate());
- assertTrue ("skip", property.skip());
+ if (!useReferenceResolverMock) {
+ assertSame(metadata, property.metadata);
+ } else {
+ assertNull("metadata", property.metadata);
+ }
+ assertNull ("nilReason", property.getNilReason());
+ assertNull ("uuidref", property.getUUIDREF());
+ assertNull ("href", property.getHRef());
+ assertNull ("role", property.getRole());
+ assertNull ("arcrole", property.getArcRole());
+ assertEquals("title", "myLinkTitle", property.getTitle());
+ assertEquals("show", XLink.Show.REPLACE, property.getShow());
+ assertEquals("actuate", XLink.Actuate.ON_LOAD, property.getActuate());
}
}
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java?rev=1550306&r1=1550305&r2=1550306&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/ReferenceResolverMock.java [UTF-8] Wed Dec 11 23:08:32 2013
@@ -53,8 +53,8 @@ public final strictfp class ReferenceRes
* }
* }
*
- * Alternatively, the {@code finally} block can be replaced by a call to {@code context.finish()}
- * in a method annotated by {@link org.junit.After}.
+ * Alternatively, the {@code finally} block can be replaced by a call to {@code context.finish()} in a method
+ * annotated by {@link org.junit.After}. This is done automatically by {@link org.apache.sis.test.XMLTestCase}.
*
* @param marshalling {@code true} for marshalling, or {@code false} for unmarshalling.
* @return The (un)marshalling context.
@@ -66,6 +66,8 @@ public final strictfp class ReferenceRes
/**
* Unconditionally returns {@code true}.
+ *
+ * @return {@code true}.
*/
@Override
public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final UUID uuid) {
@@ -74,6 +76,8 @@ public final strictfp class ReferenceRes
/**
* Unconditionally returns {@code true}.
+ *
+ * @return {@code true}.
*/
@Override
public <T> boolean canSubstituteByReference(final MarshalContext context, final Class<T> type, final T object, final XLink link) {
|