You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/07/28 23:15:04 UTC
svn commit: r1614182 - in /sis/branches/JDK7: ./
core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/
core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/direct/
core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ cor...
Author: desruisseaux
Date: Mon Jul 28 21:15:04 2014
New Revision: 1614182
URL: http://svn.apache.org/r1614182
Log:
Merge from the JDK8 branch.
Added:
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_ParameterDirection.java
- copied unchanged from r1614181, sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_ParameterDirection.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/direct/GO_MemberName.java
- copied unchanged from r1614181, sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/direct/GO_MemberName.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/
- copied from r1614181, sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/service/
sis/branches/JDK7/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/service/
- copied from r1614181, sis/branches/JDK8/core/sis-metadata/src/test/resources/org/apache/sis/metadata/iso/service/
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java
- copied unchanged from r1614181, sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/EnumAdapter.java
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultParameter.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/package-info.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
Merged /sis/branches/JDK8:r1613817-1614181
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/DCPList.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -20,6 +20,7 @@ import javax.xml.bind.annotation.XmlElem
import org.opengis.metadata.service.DistributedComputingPlatform;
import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
+import org.apache.sis.xml.Namespaces;
/**
@@ -68,7 +69,7 @@ public final class DCPList extends CodeL
* @return The value to be marshalled.
*/
@Override
- @XmlElement(name = "DCPList")
+ @XmlElement(name = "DCPList", namespace = Namespaces.SRV)
public CodeListProxy getElement() {
return proxy;
}
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/SV_CouplingType.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -20,6 +20,7 @@ import javax.xml.bind.annotation.XmlElem
import org.opengis.metadata.service.CouplingType;
import org.apache.sis.internal.jaxb.gmd.CodeListAdapter;
import org.apache.sis.internal.jaxb.gmd.CodeListProxy;
+import org.apache.sis.xml.Namespaces;
/**
@@ -68,7 +69,7 @@ public final class SV_CouplingType exten
* @return The value to be marshalled.
*/
@Override
- @XmlElement(name = "SV_CouplingType")
+ @XmlElement(name = "SV_CouplingType", namespace = Namespaces.SRV)
public CodeListProxy getElement() {
return proxy;
}
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -49,7 +49,7 @@ import org.opengis.referencing.operation
import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.Matrix;
-import org.opengis.util.CodeList;
+import org.opengis.util.Enumerated;
import org.apache.sis.measure.Units;
import org.apache.sis.math.DecimalFunctions;
@@ -929,12 +929,12 @@ public class Formatter implements Locali
}
/**
- * Appends a code list.
+ * Appends an enumeration or code list value.
* The {@linkplain Symbols#getSeparator() element separator} will be written before the code list if needed.
*
* @param code The code list to append to the WKT, or {@code null} if none.
*/
- public void append(final CodeList<?> code) {
+ public void append(final Enumerated code) {
if (code != null) {
appendSeparator();
setColor(ElementKind.CODE_LIST);
@@ -1140,7 +1140,7 @@ public class Formatter implements Locali
append(number.doubleValue());
}
}
- else if (value instanceof CodeList<?>) append((CodeList<?>) value);
+ else if (value instanceof Enumerated) append((Enumerated) value);
else if (value instanceof Date) append((Date) value);
else if (value instanceof Boolean) append((Boolean) value);
else if (value instanceof CharSequence) {
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -19,7 +19,7 @@ package org.apache.sis.metadata;
import java.util.Map;
import java.util.Iterator;
import java.util.Collection;
-import org.opengis.util.CodeList;
+import org.opengis.util.Enumerated;
import org.apache.sis.util.Emptiable;
import org.apache.sis.internal.util.CollectionsExt;
@@ -162,7 +162,7 @@ final class Pruner {
} else if (!prune && element instanceof Emptiable) {
isEmptyElement = ((Emptiable) element).isEmpty();
// If 'prune' is true, we will rather test for Emptiable after our pruning attempt.
- } else if (!(element instanceof Enum<?>) && !(element instanceof CodeList<?>)) {
+ } else if (!(element instanceof Enumerated)) {
final MetadataStandard standard = MetadataStandard.forClass(element.getClass());
if (standard != null) {
isEmptyElement = isEmpty(asMap(standard, element, prune), tested, prune);
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultOperationMetadata.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -28,6 +28,7 @@ import org.opengis.metadata.citation.Onl
import org.opengis.metadata.service.DistributedComputingPlatform;
import org.opengis.metadata.service.OperationMetadata;
import org.opengis.metadata.service.Parameter;
+import org.apache.sis.util.iso.Types;
/**
@@ -44,8 +45,8 @@ import org.opengis.metadata.service.Para
"distributedComputingPlatforms",
"operationDescription",
"invocationName",
- "connectPoints",
"parameters",
+ "connectPoints",
"dependsOn"
})
@XmlRootElement(name = "SV_OperationMetadata")
@@ -103,11 +104,11 @@ public class DefaultOperationMetadata ex
* @param platform Distributed computing platforms on which the operation has been implemented.
* @param connectPoint Handle for accessing the service interface.
*/
- public DefaultOperationMetadata(final InternationalString operationName,
+ public DefaultOperationMetadata(final CharSequence operationName,
final DistributedComputingPlatform platform,
final OnlineResource connectPoint)
{
- this.operationName = operationName;
+ this.operationName = Types.toInternationalString(operationName);
this.distributedComputingPlatforms = singleton(platform, DistributedComputingPlatform.class);
this.connectPoints = singleton(connectPoint, OnlineResource.class);
}
@@ -186,7 +187,7 @@ public class DefaultOperationMetadata ex
* @return Distributed computing platforms on which the operation has been implemented.
*/
@Override
- @XmlElement(name = "distributedComputingPlatform", required = true)
+ @XmlElement(name = "DCP", required = true)
public Collection<DistributedComputingPlatform> getDistributedComputingPlatforms() {
return distributedComputingPlatforms = nonNullCollection(distributedComputingPlatforms, DistributedComputingPlatform.class);
}
@@ -271,7 +272,7 @@ public class DefaultOperationMetadata ex
@Override
@XmlElement(name = "parameters")
public Set<Parameter> getParameters() {
- return nonNullSet(parameters, Parameter.class);
+ return parameters = nonNullSet(parameters, Parameter.class);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultParameter.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultParameter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/DefaultParameter.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -19,11 +19,17 @@ package org.apache.sis.metadata.iso.serv
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.opengis.util.TypeName;
import org.opengis.util.MemberName;
import org.opengis.util.InternationalString;
import org.opengis.metadata.service.Parameter;
import org.opengis.metadata.service.ParameterDirection;
import org.apache.sis.metadata.iso.ISOMetadata;
+import org.apache.sis.internal.jaxb.metadata.direct.GO_MemberName;
+import org.apache.sis.util.iso.Types;
+
+import static org.apache.sis.internal.jaxb.gco.PropertyType.LEGACY_XML;
/**
@@ -42,7 +48,8 @@ import org.apache.sis.metadata.iso.ISOMe
"direction",
"description",
"optionality",
- "repeatability"
+ "repeatability",
+ "valueType"
})
@XmlRootElement(name = "SV_Parameter")
public class DefaultParameter extends ISOMetadata implements Parameter {
@@ -90,11 +97,11 @@ public class DefaultParameter extends IS
* @param repeatability Indication if more than one value of the parameter may be provided.
*/
public DefaultParameter(final MemberName name,
- final InternationalString optionality,
+ final CharSequence optionality,
final boolean repeatability)
{
this.name = name;
- this.optionality = optionality;
+ this.optionality = Types.toInternationalString(optionality);
this.repeatability = repeatability;
}
@@ -149,6 +156,7 @@ public class DefaultParameter extends IS
* @return The name, as used by the service for this parameter.
*/
@Override
+ @XmlJavaTypeAdapter(GO_MemberName.class)
@XmlElement(name = "name", required = true)
public MemberName getName() {
return name;
@@ -247,4 +255,18 @@ public class DefaultParameter extends IS
checkWritePermission();
this.repeatability = newValue;
}
+
+
+
+ // Bridges for elements from legacy ISO 19119
+
+ /**
+ * For JAXB marhalling of ISO 19119 document only.
+ * Note that there is not setter method, since we expect the same information
+ * to be provided in the {@link #name} attribute type.
+ */
+ @XmlElement(name = "valueType")
+ final TypeName getValueType() {
+ return (LEGACY_XML && name != null) ? name.getAttributeType() : null;
+ }
}
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/package-info.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/package-info.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/service/package-info.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -61,8 +61,10 @@
@XmlJavaTypeAdapter(SV_OperationMetadata.class),
@XmlJavaTypeAdapter(SV_OperationChainMetadata.class),
@XmlJavaTypeAdapter(SV_Parameter.class),
+ @XmlJavaTypeAdapter(SV_ParameterDirection.class),
// Java types, primitive types and basic OGC types handling
+ @XmlJavaTypeAdapter(StringAdapter.class),
@XmlJavaTypeAdapter(InternationalStringAdapter.class),
@XmlJavaTypeAdapter(GO_GenericName.class),
@XmlJavaTypeAdapter(GO_Boolean.class), @XmlJavaTypeAdapter(type=boolean.class, value=GO_Boolean.class)
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -52,6 +52,7 @@ public final strictfp class AllMetadataT
/**
* Creates a new test case with all GeoAPI interfaces and code lists to test.
*/
+ @SuppressWarnings("deprecation")
public AllMetadataTest() {
super(MetadataStandard.ISO_19115,
org.opengis.metadata.ApplicationSchemaInformation.class,
@@ -221,6 +222,21 @@ public final strictfp class AllMetadataT
}
/**
+ * Returns the name of the XML element for the given UML element.
+ * This method checks for the special cases which are known to have different UML and XML names.
+ *
+ * @return {@inheritDoc}
+ */
+ @Override
+ protected String getExpectedName(final UML uml) {
+ String name = uml.identifier();
+ if (name.equals("distributedComputingPlatform")) {
+ name = "DCP";
+ }
+ return name;
+ }
+
+ /**
* Returns the expected namespace for an element defined by the given specification.
* For example the namespace of any type defined by {@link Specification#ISO_19115}
* is {@code "http://www.isotc211.org/2005/gmd"}.
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -73,6 +73,7 @@ import org.junit.BeforeClass;
org.apache.sis.metadata.iso.identification.DefaultResolutionTest.class,
org.apache.sis.metadata.iso.identification.DefaultBrowseGraphicTest.class,
org.apache.sis.metadata.iso.identification.DefaultDataIdentificationTest.class,
+ org.apache.sis.metadata.iso.service.DefaultServiceIdentificationTest.class,
org.apache.sis.metadata.iso.quality.AbstractElementTest.class,
org.apache.sis.metadata.iso.quality.AbstractPositionalAccuracyTest.class,
org.apache.sis.metadata.iso.lineage.DefaultLineageTest.class,
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -71,6 +71,7 @@ public class CodeListSet<E extends CodeL
* A pool of code list arrays. When many {@code CodeListSet} instances are for the
* same code list type, this allows those instances to share the same arrays.
*/
+ @SuppressWarnings("rawtypes")
private static final WeakHashSet<CodeList[]> POOL = new WeakHashSet<>(CodeList[].class);
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -28,7 +28,7 @@ import java.text.Format;
import java.text.ParsePosition;
import java.text.ParseException;
import java.util.regex.Matcher;
-import org.opengis.util.CodeList;
+import org.opengis.util.Enumerated;
import org.opengis.util.InternationalString;
import org.apache.sis.io.LineAppender;
import org.apache.sis.io.TableAppender;
@@ -342,6 +342,7 @@ public class TreeTableFormat extends Tab
* @throws ParseException If an error occurred while parsing a node value.
*/
@Override
+ @SuppressWarnings("null")
public TreeTable parse(final CharSequence text, final ParsePosition pos) throws ParseException {
final Matcher matcher = getColumnSeparatorMatcher(text);
final int length = text.length();
@@ -630,8 +631,8 @@ public class TreeTableFormat extends Tab
text = ((InternationalString) value).toString(getDisplayLocale());
} else if (value instanceof CharSequence) {
text = value.toString();
- } else if (value instanceof CodeList<?>) {
- text = Types.getCodeTitle((CodeList<?>) value).toString(getDisplayLocale());
+ } else if (value instanceof Enumerated) {
+ text = Types.getCodeTitle((Enumerated) value).toString(getDisplayLocale());
} else if (value instanceof Enum<?>) {
text = CharSequences.upperCaseToSentence(((Enum<?>) value).name());
} else {
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -61,7 +61,7 @@ import java.util.Objects;
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
* @module
*/
@XmlType(name = "GenericName") // Actually 'gml:CodeType', but the later is used elsewhere.
@@ -102,10 +102,10 @@ public abstract class AbstractName imple
*
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of {@code AbstractName},
- * then it is returned unchanged.</li>
* <li>Otherwise if the given object is an instance of {@link LocalName}, then this
* method delegates to {@link DefaultLocalName#castOrCopy(LocalName)}.</li>
+ * <li>Otherwise if the given object is already an instance of {@code AbstractName},
+ * then it is returned unchanged.</li>
* <li>Otherwise a new instance of an {@code AbstractName} subclass is created using the
* {@link DefaultNameFactory#createGenericName(NameSpace, CharSequence[])} method.</li>
* </ul>
@@ -115,12 +115,12 @@ public abstract class AbstractName imple
* given object itself), or {@code null} if the argument was null.
*/
public static AbstractName castOrCopy(final GenericName object) {
- if (object == null || object instanceof AbstractName) {
- return (AbstractName) object;
- }
if (object instanceof LocalName) {
return DefaultLocalName.castOrCopy((LocalName) object);
}
+ if (object == null || object instanceof AbstractName) {
+ return (AbstractName) object;
+ }
/*
* Recreates a new name for the given name in order to get
* a SIS implementation from an arbitrary implementation.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -31,7 +31,6 @@ import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.apache.sis.xml.Namespaces;
import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.jaxb.gco.CharSequenceAdapter;
// Branch-dependent imports
@@ -58,7 +57,7 @@ import java.util.Objects;
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
- * @version 0.3
+ * @version 0.5
* @module
*
* @see DefaultNameSpace
@@ -153,12 +152,12 @@ public class DefaultLocalName extends Ab
*
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
+ * <li>Otherwise if the given object is an instance of {@link MemberName} or {@link TypeName},
+ * then this method delegates to {@code castOrCopy(…)} method of the corresponding subclass.</li>
* <li>Otherwise if the given object is already an instance of {@code DefaultLocalName},
* then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultLocalName} instance is created using the
- * {@link DefaultNameFactory#createLocalName(NameSpace, CharSequence)} method,
- * or the {@code createTypeName} or {@code createMemberName} variants if the
- * given object implements the corresponding interface.</li>
+ * <li>Otherwise a new {@code DefaultLocalName} instance is created
+ * with the same values than the given name.</li>
* </ul>
*
* @param object The object to get as a SIS implementation, or {@code null} if none.
@@ -166,24 +165,22 @@ public class DefaultLocalName extends Ab
* given object itself), or {@code null} if the argument was null.
*/
public static DefaultLocalName castOrCopy(final LocalName object) {
+ if (object instanceof MemberName) {
+ return DefaultMemberName.castOrCopy((MemberName) object);
+ }
+ if (object instanceof TypeName) {
+ return DefaultTypeName.castOrCopy((TypeName) object);
+ }
if (object == null || object instanceof DefaultLocalName) {
return (DefaultLocalName) object;
}
final NameSpace scope = object.scope();
final InternationalString name = object.toInternationalString();
- final LocalName result;
- if (object instanceof MemberName) {
- result = DefaultFactories.SIS_NAMES.createMemberName(scope, name, ((MemberName) object).getAttributeType());
- } else if (object instanceof TypeName) {
- result = DefaultFactories.SIS_NAMES.createTypeName(scope, name);
+ if (scope instanceof DefaultNameSpace) {
+ return ((DefaultNameSpace) scope).local(name, null); // May return a cached instance.
} else {
- result = DefaultFactories.SIS_NAMES.createLocalName(scope, name);
+ return new DefaultLocalName(scope, name);
}
- /*
- * Following cast should be safe because the SIS_NAMES factory is fixed to a
- * DefaultNameFactory instance, which is known to create AbstractName instances.
- */
- return (DefaultLocalName) result;
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultMemberName.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -86,6 +86,31 @@ public class DefaultMemberName extends D
}
/**
+ * Returns a SIS member name implementation with the values of the given arbitrary implementation.
+ * This method performs the first applicable action in the following choices:
+ *
+ * <ul>
+ * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
+ * <li>Otherwise if the given object is already an instance of {@code DefaultMemberName},
+ * then it is returned unchanged.</li>
+ * <li>Otherwise a new {@code DefaultMemberName} instance is created
+ * with the same values than the given name.</li>
+ * </ul>
+ *
+ * @param object The object to get as a SIS implementation, or {@code null} if none.
+ * @return A SIS implementation containing the values of the given object (may be the
+ * given object itself), or {@code null} if the argument was null.
+ *
+ * @since 0.5
+ */
+ public static DefaultMemberName castOrCopy(final MemberName object) {
+ if (object == null || object instanceof DefaultMemberName) {
+ return (DefaultMemberName) object;
+ }
+ return new DefaultMemberName(object.scope(), object.toInternationalString(), object.getAttributeType());
+ }
+
+ /**
* Returns the type of the data associated with the record member.
*
* @return The type of the data associated with the record member.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -229,6 +229,10 @@ public class DefaultNameFactory extends
*/
@Override
public LocalName createLocalName(final NameSpace scope, final CharSequence name) {
+ /*
+ * Maintenance note: if the body of this method is modified (except for the use of the cache),
+ * consider updating DefaultLocalName.castOrCopy(LocalName) method accordingly.
+ */
if (scope instanceof DefaultNameSpace) {
// Following may return a cached instance.
return ((DefaultNameSpace) scope).local(name, null);
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -37,7 +37,7 @@ import org.opengis.util.NameSpace;
* @author Guilhem Legal (Geomatys)
* @author Cédric Briançon (Geomatys)
* @since 0.3 (derived from geotk-3.00)
- * @version 0.3
+ * @version 0.5
* @module
*
* @see DefaultMemberName
@@ -68,4 +68,29 @@ public class DefaultTypeName extends Def
protected DefaultTypeName(final NameSpace scope, final CharSequence name) {
super(scope, name);
}
+
+ /**
+ * Returns a SIS type name implementation with the values of the given arbitrary implementation.
+ * This method performs the first applicable action in the following choices:
+ *
+ * <ul>
+ * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
+ * <li>Otherwise if the given object is already an instance of {@code DefaultTypeName},
+ * then it is returned unchanged.</li>
+ * <li>Otherwise a new {@code DefaultTypeName} instance is created
+ * with the same values than the given name.</li>
+ * </ul>
+ *
+ * @param object The object to get as a SIS implementation, or {@code null} if none.
+ * @return A SIS implementation containing the values of the given object (may be the
+ * given object itself), or {@code null} if the argument was null.
+ *
+ * @since 0.5
+ */
+ public static DefaultTypeName castOrCopy(final TypeName object) {
+ if (object == null || object instanceof DefaultTypeName) {
+ return (DefaultTypeName) object;
+ }
+ return new DefaultTypeName(object.scope(), object.toInternationalString());
+ }
}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -34,6 +34,7 @@ import org.opengis.util.CodeList;
import org.opengis.util.NameFactory;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
+import org.opengis.util.Enumerated;
import org.opengis.metadata.Identifier;
import org.apache.sis.util.Static;
import org.apache.sis.util.Locales;
@@ -50,9 +51,9 @@ import org.apache.sis.internal.system.De
* This class provides:
*
* <ul>
- * <li>{@link #getStandardName(Class)}, {@link #getListName(CodeList)} and {@link #getCodeName(CodeList)}
+ * <li>{@link #getStandardName(Class)}, {@link #getListName(Enumerated)} and {@link #getCodeName(Enumerated)}
* for fetching ISO names if possible.</li>
- * <li>{@link #getCodeTitle(CodeList)}, {@link #getDescription(CodeList)} and
+ * <li>{@link #getCodeTitle(Enumerated)}, {@link #getDescription(Enumerated)} and
* {@link #getDescription(Class)} for fetching human-readable descriptions.</li>
* <li>{@link #forStandardName(String)} and {@link #forCodeName(Class, String, boolean)} for
* fetching an instance from a name (converse of above {@code get} methods).</li>
@@ -127,14 +128,15 @@ public final class Types extends Static
}
/**
- * Returns the ISO classname (if available) or the Java classname (as a fallback)
- * of the given code. This method uses the {@link UML} annotation if it exists, or
+ * Returns the ISO classname (if available) or the Java classname (as a fallback) of the given
+ * enumeration or code list value. This method uses the {@link UML} annotation if it exists, or
* fallback on the {@linkplain Class#getSimpleName() simple class name} otherwise.
*
* <div class="note"><b>Examples:</b>
* <ul>
- * <li>{@code getListName(AxisDirection.NORTH)} returns {@code "CS_AxisDirection"}.</li>
- * <li>{@code getListName(CharacterSet.UTF_8)} returns {@code "MD_CharacterSetCode"}.</li>
+ * <li>{@code getListName(ParameterDirection.IN_OUT)} returns {@code "SV_ParameterDirection"}.</li>
+ * <li>{@code getListName(AxisDirection.NORTH)} returns {@code "CS_AxisDirection"}.</li>
+ * <li>{@code getListName(CharacterSet.UTF_8)} returns {@code "MD_CharacterSetCode"}.</li>
* <li>{@code getListName(ImagingCondition.BLURRED_IMAGE)} returns {@code "MD_ImagingConditionCode"}.</li>
* </ul>
* </div>
@@ -142,23 +144,24 @@ public final class Types extends Static
* @param code The code for which to get the class name, or {@code null}.
* @return The ISO (preferred) or Java (fallback) class name, or {@code null} if the given code is null.
*/
- public static String getListName(final CodeList<?> code) {
+ public static String getListName(final Enumerated code) {
if (code == null) {
return null;
}
- final Class<?> type = code.getClass();
+ final Class<?> type = (code instanceof Enum<?>) ? ((Enum<?>) code).getDeclaringClass() : code.getClass();
final String id = getStandardName(type);
return (id != null) ? id : type.getSimpleName();
}
/**
- * Returns the ISO name (if available) or the Java name (as a fallback) of the given code.
- * If the code has no {@link UML} identifier, then the programmatic name is used as a fallback.
+ * Returns the ISO name (if available) or the Java name (as a fallback) of the given enumeration or code list
+ * value. If the value has no {@link UML} identifier, then the programmatic name is used as a fallback.
*
* <div class="note"><b>Examples:</b>
* <ul>
- * <li>{@code getCodeName(AxisDirection.NORTH)} returns {@code "north"}.</li>
- * <li>{@code getCodeName(CharacterSet.UTF_8)} returns {@code "utf8"}.</li>
+ * <li>{@code getCodeName(ParameterDirection.IN_OUT)} returns {@code "in/out"}.</li>
+ * <li>{@code getCodeName(AxisDirection.NORTH)} returns {@code "north"}.</li>
+ * <li>{@code getCodeName(CharacterSet.UTF_8)} returns {@code "utf8"}.</li>
* <li>{@code getCodeName(ImagingCondition.BLURRED_IMAGE)} returns {@code "blurredImage"}.</li>
* </ul>
* </div>
@@ -167,12 +170,12 @@ public final class Types extends Static
* @return The UML identifiers or programmatic name for the given code,
* or {@code null} if the given code is null.
*
- * @see #getCodeLabel(CodeList)
- * @see #getCodeTitle(CodeList)
- * @see #getDescription(CodeList)
+ * @see #getCodeLabel(Enumerated)
+ * @see #getCodeTitle(Enumerated)
+ * @see #getDescription(Enumerated)
* @see #forCodeName(Class, String, boolean)
*/
- public static String getCodeName(final CodeList<?> code) {
+ public static String getCodeName(final Enumerated code) {
if (code == null) {
return null;
}
@@ -181,10 +184,10 @@ public final class Types extends Static
}
/**
- * Returns a unlocalized title for the given code.
+ * Returns a unlocalized title for the given enumeration or code list value.
* This method builds a title using heuristics rules, which should give reasonable
* results without the need of resource bundles. For better results, consider using
- * {@link #getCodeTitle(CodeList)} instead.
+ * {@link #getCodeTitle(Enumerated)} instead.
*
* <p>The current heuristic implementation iterates over {@linkplain CodeList#names() all code names},
* selects the longest one excluding the {@linkplain CodeList#name() field name} if possible, then
@@ -201,11 +204,11 @@ public final class Types extends Static
* @param code The code from which to get a title, or {@code null}.
* @return A unlocalized title for the given code, or {@code null} if the given code is null.
*
- * @see #getCodeName(CodeList)
- * @see #getCodeTitle(CodeList)
- * @see #getDescription(CodeList)
+ * @see #getCodeName(Enumerated)
+ * @see #getCodeTitle(Enumerated)
+ * @see #getDescription(Enumerated)
*/
- public static String getCodeLabel(final CodeList<?> code) {
+ public static String getCodeLabel(final Enumerated code) {
if (code == null) {
return null;
}
@@ -223,30 +226,30 @@ public final class Types extends Static
}
/**
- * Returns the title of the given code. Title are usually much shorter than descriptions.
- * English titles are often the same than the {@linkplain #getCodeLabel(CodeList) code labels}.
+ * Returns the title of the given enumeration or code list value. Title are usually much shorter than descriptions.
+ * English titles are often the same than the {@linkplain #getCodeLabel(Enumerated) code labels}.
*
* @param code The code for which to get the title, or {@code null}.
* @return The title, or {@code null} if the given code is null.
*
- * @see #getDescription(CodeList)
+ * @see #getDescription(Enumerated)
*/
- public static InternationalString getCodeTitle(final CodeList<?> code) {
+ public static InternationalString getCodeTitle(final Enumerated code) {
return (code != null) ? new CodeTitle(code) : null;
}
/**
- * Returns the description of the given code, or {@code null} if none.
+ * Returns the description of the given enumeration or code list value, or {@code null} if none.
* For a description of the code list as a whole instead than a particular code,
* see {@link Types#getDescription(Class)}.
*
* @param code The code for which to get the localized description, or {@code null}.
* @return The description, or {@code null} if none or if the given code is null.
*
- * @see #getCodeTitle(CodeList)
- * @see #getDescription(Class)
+ * @see #getCodeTitle(Enumerated)
+ * @see #getDescription(Enumerated)
*/
- public static InternationalString getDescription(final CodeList<?> code) {
+ public static InternationalString getDescription(final Enumerated code) {
if (code != null) {
final String resources = getResources(code.getClass().getName());
if (resources != null) {
@@ -263,7 +266,7 @@ public final class Types extends Static
* @param type The GeoAPI interface or code list from which to get the description, or {@code null}.
* @return The description, or {@code null} if none or if the given type is {@code null}.
*
- * @see #getDescription(CodeList)
+ * @see #getDescription(Enumerated)
*/
public static InternationalString getDescription(final Class<?> type) {
final String name = getStandardName(type);
@@ -381,14 +384,14 @@ public final class Types extends Static
/**
* The code list for which to create a title.
*/
- private final CodeList<?> code;
+ private final Enumerated code;
/**
* Creates a new international string for the given code list element.
*
* @param code The code list for which to create a title.
*/
- CodeTitle(final CodeList<?> code) {
+ CodeTitle(final Enumerated code) {
super("org.opengis.metadata.CodeLists", resourceKey(code));
this.code = code;
}
@@ -420,7 +423,7 @@ public final class Types extends Static
/**
* Returns the resource key for the given code list.
*/
- static String resourceKey(final CodeList<?> code) {
+ static String resourceKey(final Enumerated code) {
String key = getCodeName(code);
if (key.indexOf(SEPARATOR) < 0) {
key = getListName(code) + SEPARATOR + key;
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -30,6 +30,7 @@ import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import org.opengis.util.CodeList;
+import org.opengis.util.Enumerated;
import org.opengis.util.InternationalString;
import org.apache.sis.util.Debug;
import org.apache.sis.util.Classes;
@@ -404,8 +405,8 @@ public class IndexedResourceBundle exten
replacement = message;
} else if (element instanceof Class<?>) {
replacement = Classes.getShortName((Class<?>) element);
- } else if (element instanceof CodeList<?>) {
- replacement = Types.getCodeTitle((CodeList<?>) element).toString(getLocale());
+ } else if (element instanceof Enumerated) {
+ replacement = Types.getCodeTitle((Enumerated) element).toString(getLocale());
}
// No need to check for Numbers or Dates instances, since they are
// properly formatted in the ResourceBundle locale by MessageFormat.
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/AnnotationsTestCase.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -231,6 +231,16 @@ public abstract strictfp class Annotatio
}
/**
+ * Returns the name of the XML element for the given UML element.
+ *
+ * @param uml The UML element.
+ * @return The corresponding XML element name.
+ */
+ protected String getExpectedName(final UML uml) {
+ return uml.identifier();
+ }
+
+ /**
* Replaces {@value #DEFAULT} value by the {@link XmlSchema} namespace if needed,
* then performs validity check on the resulting namespace. This method checks that:
*
@@ -542,7 +552,7 @@ public abstract strictfp class Annotatio
* is because subclasses may choose to override the above test method.
*/
if (uml != null) {
- assertEquals("Wrong @XmlElement.name().", uml.identifier(), element.name());
+ assertEquals("Wrong @XmlElement.name().", getExpectedName(uml), element.name());
assertEquals("Wrong @XmlElement.required().", uml.obligation() == Obligation.MANDATORY, element.required());
}
/*
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java?rev=1614182&r1=1614181&r2=1614182&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java [UTF-8] Mon Jul 28 21:15:04 2014
@@ -27,6 +27,7 @@ import org.opengis.metadata.citation.Cit
import org.opengis.metadata.citation.OnLineFunction;
import org.opengis.metadata.content.ImagingCondition;
import org.opengis.metadata.identification.CharacterSet;
+import org.opengis.metadata.service.ParameterDirection;
import org.opengis.referencing.datum.Datum;
import org.opengis.referencing.cs.AxisDirection;
import org.apache.sis.test.TestCase;
@@ -40,7 +41,7 @@ import static org.opengis.test.Assert.*;
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.3 (derived from geotk-2.1)
- * @version 0.4
+ * @version 0.5
* @module
*/
public final strictfp class TypesTest extends TestCase {
@@ -151,7 +152,7 @@ public final strictfp class TypesTest ex
}
/**
- * Tests the {@link Types#getDescription(CodeList)} method.
+ * Tests the {@link Types#getDescription(Enumerated)} method.
*/
@Test
public void testGetCodeDescription() {
@@ -165,27 +166,29 @@ public final strictfp class TypesTest ex
}
/**
- * Tests the examples given in {@link Types#getListName(CodeList)} javadoc.
+ * Tests the examples given in {@link Types#getListName(Enumerated)} javadoc.
*/
@Test
public void testGetListName() {
- assertEquals("CS_AxisDirection", Types.getListName(AxisDirection .NORTH));
- assertEquals("MD_CharacterSetCode", Types.getListName(CharacterSet .UTF_8));
- assertEquals("MD_ImagingConditionCode", Types.getListName(ImagingCondition.BLURRED_IMAGE));
+ assertEquals("SV_ParameterDirection", Types.getListName(ParameterDirection.IN_OUT));
+ assertEquals("CS_AxisDirection", Types.getListName(AxisDirection .NORTH));
+ assertEquals("MD_CharacterSetCode", Types.getListName(CharacterSet .UTF_8));
+ assertEquals("MD_ImagingConditionCode", Types.getListName(ImagingCondition .BLURRED_IMAGE));
}
/**
- * Tests the examples given in {@link Types#getCodeName(CodeList)} javadoc.
+ * Tests the examples given in {@link Types#getCodeName(Enumerated)} javadoc.
*/
@Test
public void testGetCodeName() {
- assertEquals("north", Types.getCodeName(AxisDirection .NORTH));
- assertEquals("utf8", Types.getCodeName(CharacterSet .UTF_8));
- assertEquals("blurredImage", Types.getCodeName(ImagingCondition.BLURRED_IMAGE));
+ assertEquals("in/out", Types.getCodeName(ParameterDirection.IN_OUT));
+ assertEquals("north", Types.getCodeName(AxisDirection .NORTH));
+ assertEquals("utf8", Types.getCodeName(CharacterSet .UTF_8));
+ assertEquals("blurredImage", Types.getCodeName(ImagingCondition .BLURRED_IMAGE));
}
/**
- * Tests the examples given in {@link Types#getCodeLabel(CodeList)} javadoc.
+ * Tests the examples given in {@link Types#getCodeLabel(Enumerated)} javadoc.
*/
@Test
public void testGetCodeLabel() {
@@ -195,7 +198,7 @@ public final strictfp class TypesTest ex
}
/**
- * Tests {@link Types#getCodeTitle(CodeList)}.
+ * Tests {@link Types#getCodeTitle(Enumerated)}.
*/
@Test
public void testGetCodeTitle() {