3c5f0bdab6b0de6029e0e93084a254b44867eba1
[controller.git] / opendaylight / config / config-persister-file-xml-adapter / src / main / java / org / opendaylight / controller / config / persist / storage / file / xml / model / StringTrimAdapter.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.persist.storage.file.xml.model;
9
10 import javax.xml.bind.annotation.adapters.XmlAdapter;
11
12 final class StringTrimAdapter extends XmlAdapter<String, String> {
13     @Override
14     public String unmarshal(String v) throws Exception {
15         if (v == null) {
16             return null;
17         }
18         return v.trim();
19     }
20
21     @Override
22     public String marshal(String v) throws Exception {
23         if (v == null) {
24             return null;
25         }
26         return v.trim();
27     }
28 }