sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1517787 - /sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java
Date Tue, 27 Aug 2013 11:05:56 GMT
Author: desruisseaux
Date: Tue Aug 27 11:05:56 2013
New Revision: 1517787

URL: http://svn.apache.org/r1517787
Log:
Added a missing JAXB adapter required by some projects that depend on SIS.

Added:
    sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java
  (with props)

Added: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java?rev=1517787&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java
(added)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java
[UTF-8] Tue Aug 27 11:05:56 2013
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.jaxb.metadata;
+
+import javax.xml.bind.annotation.XmlElementRef;
+import org.opengis.metadata.Metadata;
+import org.apache.sis.metadata.iso.DefaultMetadata;
+import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+/**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author  Guilhem Legal (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final class MD_Metadata extends PropertyType<MD_Metadata, Metadata> {
+    /**
+     * Empty constructor for JAXB only.
+     */
+    public MD_Metadata() {
+    }
+
+    /**
+     * 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.
+     */
+    @Override
+    protected Class<Metadata> getBoundType() {
+        return Metadata.class;
+    }
+
+    /**
+     * Constructor for the {@link #wrap} method only.
+     */
+    private MD_Metadata(final Metadata metadata) {
+        super(metadata);
+    }
+
+    /**
+     * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata
value
+     * in a {@code <gmd:MD_Metadata>} XML element.
+     *
+     * @param  metadata The metadata element to marshall.
+     * @return A {@code PropertyType} wrapping the given the metadata element.
+     */
+    @Override
+    protected MD_Metadata wrap(final Metadata metadata) {
+        return new MD_Metadata(metadata);
+    }
+
+    /**
+     * Invoked by JAXB at marshalling time for getting the actual metadata to write
+     * inside the {@code <gmd:MD_Metadata>} XML element.
+     * This is the value or a copy of the value given in argument to the {@code wrap} method.
+     *
+     * @return The metadata to be marshalled.
+     */
+    @XmlElementRef
+    public DefaultMetadata getElement() {
+        return skip() ? null : DefaultMetadata.castOrCopy(metadata);
+    }
+
+    /**
+     * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+     *
+     * @param metadata The unmarshalled metadata.
+     */
+    public void setElement(final DefaultMetadata metadata) {
+        this.metadata = metadata;
+    }
+}

Propchange: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Metadata.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8



Mime
View raw message