--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.binding.data.codec.api;
+
+import javax.annotation.Nullable;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+
+/**
+ *
+ * Navigable tree representing hierarchy of Binding to Normalized Node codecs
+ *
+ * This navigable tree is associated to conrete set of YANG models, represented
+ * by SchemaContext and provides access to subtree specific serialization
+ * context.
+ *
+ * TODO: Add more detailed documentation
+ **/
+public interface BindingCodecTree {
+
+ @Nullable <T extends DataObject> BindingCodecTreeNode<T> getSubtreeCodec(InstanceIdentifier<T> path);
+
+ @Nullable BindingCodecTreeNode<?> getSubtreeCodec(YangInstanceIdentifier path);
+
+ @Nullable BindingCodecTreeNode<?> getSubtreeCodec(SchemaPath path);
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.binding.data.codec.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+public interface BindingCodecTreeFactory {
+
+ /**
+ *
+ * Creates Binding Codec Tree for specified Binding runtime context.
+ *
+ * @param context
+ * Binding Runtime Context for which Binding codecs should be
+ * instantiated.
+ * @return Binding Codec Tree for specified Binding runtime context.
+ */
+ BindingCodecTree create(BindingRuntimeContext context);
+
+ /**
+ *
+ * Creates Binding Codec Tree for specified Binding runtime context.
+ *
+ * @param context
+ * Binding Runtime Context for which Binding codecs should be
+ * instantiated.
+ * @param bindingClasses
+ * @return Binding Codec Tree for specified Binding runtime context.
+ */
+ @Beta
+ BindingCodecTree create(SchemaContext context, Class<?>... bindingClasses);
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.binding.data.codec.api;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Optional;
+import com.google.common.collect.ImmutableCollection;
+import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opendaylight.yangtools.yang.binding.BindingStreamEventWriter;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
+
+/**
+ * Subtree codec specific to model subtree between Java Binding and
+ * NormalizedNode.
+ *
+ */
+@Beta
+public interface BindingCodecTreeNode<T extends DataObject> extends BindingNormalizedNodeCodec<T> {
+
+ /**
+ *
+ * Returns binding class of interface which represents API of current
+ * schema node.
+ *
+ * The result is same as invoking {@link DataObject#getImplementedInterface()}
+ * on instance of data.
+ *
+ * @return interface which defines API of binding representation of data.
+ */
+ @Nonnull
+ Class<T> getBindingClass();
+
+ /**
+ *
+ * Returns child context as if it was walked by
+ * {@link BindingStreamEventWriter}. This means that to enter case, one must
+ * issue getChild(ChoiceClass).getChild(CaseClass).
+ *
+ * @param childClass
+ * @return Context of child
+ * @throws IllegalArgumentException
+ * If supplied child class is not valid in specified context.
+ */
+ @Nonnull
+ <E extends DataObject> BindingCodecTreeNode<E> streamChild(@Nonnull Class<E> childClass);
+
+ /**
+ *
+ * Returns child context as if it was walked by
+ * {@link BindingStreamEventWriter}. This means that to enter case, one must
+ * issue getChild(ChoiceClass).getChild(CaseClass).
+ *
+ * This method differs from {@link #streamChild(Class)}, that is less
+ * stricter for interfaces representing augmentation and cases, that
+ * may return {@link BindingCodecTreeNode} even if augmentation interface
+ * containing same data was supplied and does not represent augmentation
+ * of this node.
+ *
+ * @param childClass
+ * @return Context of child or Optional absent is supplied class is not
+ * applicable in context.
+ */
+ <E extends DataObject> Optional<? extends BindingCodecTreeNode<E>> possibleStreamChild(@Nonnull Class<E> childClass);
+
+ /**
+ * Returns nested node context using supplied YANG Instance Identifier
+ *
+ * @param child
+ * Yang Instance Identifier Argument
+ * @return Context of child
+ * @throws IllegalArgumentException
+ * If supplied argument does not represent valid child.
+ */
+ @Nonnull
+ BindingCodecTreeNode<?> yangPathArgumentChild(@Nonnull YangInstanceIdentifier.PathArgument child);
+
+ /**
+ * Returns nested node context using supplied Binding Instance Identifier
+ * and adds YANG instance identifiers to supplied list.
+ *
+ * @param arg
+ * Binding Instance Identifier Argument
+ * @param builder
+ * Mutable instance of list, which is appended by YangInstanceIdentifiers
+ * as tree is walked. Use null if such side-product is not needed.
+ * @return Context of child
+ * @throws IllegalArgumentException
+ * If supplied argument does not represent valid child.
+ */
+ @Nonnull
+ BindingCodecTreeNode<?> bindingPathArgumentChild(@Nonnull InstanceIdentifier.PathArgument arg,
+ @Nullable List<YangInstanceIdentifier.PathArgument> builder);
+
+ /**
+ *
+ * Returns codec which uses caches serialization / deserialization results
+ *
+ * Caching may introduce performance penalty to serialization / deserialization
+ * but may decrease use of heap for repetitive objects.
+ *
+ *
+ * @param cacheSpecifier Set of objects, for which cache may be in place
+ * @return Codec whihc uses cache for serialization / deserialization.
+ */
+ @Nonnull
+ BindingNormalizedNodeCachingCodec<T> createCachingCodec(@Nonnull
+ ImmutableCollection<Class<? extends DataObject>> cacheSpecifier);
+
+ @Beta
+ void writeAsNormalizedNode(T data, NormalizedNodeStreamWriter writer);
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.binding.data.codec.api;
+
+import com.google.common.annotations.Beta;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+/**
+ *
+ * Caching variant of Binding to Normalized Node codec.
+ *
+ * Caching may introduce performance penalty to serialization / deserialization
+ * but may decrease use of heap for repetitive objects.
+ *
+ * @param <T> Binding representtion of data
+ *
+ */
+@Beta
+public interface BindingNormalizedNodeCachingCodec<T extends DataObject> extends BindingNormalizedNodeCodec<T>, AutoCloseable {
+
+ /**
+ *
+ * Invoking close will invalidate this codec and any of its child
+ * codecs and will invalidate cache.
+ *
+ * Any subsequent calls to this codec will fail with {@link IllegalStateException}
+ * thrown.
+ *
+ */
+ @Override
+ public void close();
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.binding.data.codec.api;
+
+import com.google.common.annotations.Beta;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+
+/**
+ *
+ * Codec providing serialization and deserializiation between Binding
+ * and NormalizedNode representation of data.
+ *
+ *
+ * @param <T> Binding representation of data
+ */
+@Beta
+public interface BindingNormalizedNodeCodec<T extends DataObject> {
+
+ /**
+ * Converts from Normalized Node to Binding representation of data.
+ *
+ * @param data Normalized Node representation of data
+ * @return Binding representation of data
+ */
+ @Nonnull T deserialize(@Nonnull NormalizedNode<?,?> data);
+
+ /**
+ * Converts from Binding to Normalized Node representation of data.
+ *
+ * @param data Binding representation of data
+ * @return Normalized Node representation of data
+ */
+ @Nonnull NormalizedNode<?,?> serialize(@Nonnull T data);
+
+}