Added tests for yang.model.util
[yangtools.git] / yang / yang-data-codec-gson / src / main / java / org / opendaylight / yangtools / yang / data / codec / gson / helpers / RestCodecFactory.java
1 /*
2  * Copyright (c) 2014 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.yangtools.yang.data.codec.gson.helpers;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.base.Preconditions;
12
13 import org.opendaylight.yangtools.concepts.Codec;
14 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
15
16 /**
17  * This class is implementation-internal and subject to change. Please do not use it.
18  */
19 @Beta
20 public final class RestCodecFactory {
21     private final SchemaContextUtils utils;
22
23     private RestCodecFactory(final SchemaContextUtils utils) {
24         this.utils = Preconditions.checkNotNull(utils);
25     }
26
27     public static RestCodecFactory create(final SchemaContextUtils utils) {
28         return new RestCodecFactory(utils);
29     }
30
31     public final Codec<Object, Object> codecFor(final TypeDefinition<?> typeDefinition) {
32         // FIXME: implement loadingcache
33         return new ObjectCodec(utils, typeDefinition);
34     }
35 }