UnionTypeCodec should not throw raw Exception
[yangtools.git] / code-generator / binding-data-codec / src / main / java / org / opendaylight / yangtools / binding / data / codec / impl / AugmentationNodeContext.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.binding.data.codec.impl;
9
10 import com.google.common.base.Preconditions;
11
12 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
15
16 final class AugmentationNodeContext extends DataObjectCodecContext<AugmentationSchema> {
17
18     public AugmentationNodeContext(final DataContainerCodecPrototype<AugmentationSchema> prototype) {
19         super(prototype);
20     }
21
22     @Override
23     protected Object dataFromNormalizedNode(final NormalizedNode<?, ?> normalizedNode) {
24         Preconditions.checkArgument(normalizedNode instanceof AugmentationNode);
25         return LazyDataObject.create(this, (AugmentationNode) normalizedNode);
26     }
27 }