2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 2021 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.apex.model.basicmodel.xml;
24 import java.io.Serializable;
25 import javax.xml.bind.annotation.XmlAccessType;
26 import javax.xml.bind.annotation.XmlAccessorType;
27 import javax.xml.bind.annotation.XmlType;
28 import javax.xml.bind.annotation.adapters.XmlAdapter;
29 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
32 * This class manages marshaling and unmarshaling of Apex {@link AxReferenceKey} concepts using JAXB. The local name in
33 * reference keys must have specific handling.
35 @XmlAccessorType(XmlAccessType.PROPERTY)
36 @XmlType(namespace = "http://www.onap.org/policy/apex-pdp")
37 public class AxReferenceKeyAdapter extends XmlAdapter<String, AxReferenceKey> implements Serializable {
39 private static final long serialVersionUID = -3480405083900107029L;
45 public final String marshal(final AxReferenceKey key) throws Exception {
46 return key.getLocalName();
53 public final AxReferenceKey unmarshal(final String key) throws Exception {
54 final var axReferenceKey = new AxReferenceKey();
55 axReferenceKey.setLocalName(key);
56 return axReferenceKey;