2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.yangtools.yang.data.impl.schema.transform.base.parser;
12 import javax.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.NormalizedNodeBuilder;
17 import org.opendaylight.yangtools.yang.data.impl.schema.transform.ToNormalizedNodeParser;
20 * Extensible parser allows its subclasses to customize the building process of normalized nodes
27 public interface ExtensibleParser<P extends YangInstanceIdentifier.PathArgument, E, N extends NormalizedNode<P, ?>, S>
28 extends ToNormalizedNodeParser<E, N, S> {
31 * Provide building strategy
33 BuildingStrategy<P, N> getBuildingStrategy();
36 * Building strategy serves as a set of hooks into the parsing process.
41 interface BuildingStrategy<P extends YangInstanceIdentifier.PathArgument, N extends NormalizedNode<P, ?>> {
44 * Build normalized node from its builder
46 * @param builder filled builder for node
47 * @return built normalized node or null if the node should not be built
49 @Nullable N build(NormalizedNodeBuilder<P, ?, N> builder);
52 * Hook for subclasses to handle attributes associated with current node. This is called before the build method
53 * and allows subclasses to react to node's attributes e.g. modification operation
55 * @param attributes attributes for node
56 * @param containerBuilder builder created for node. Can be modified according to attributes e.g. remove attribute
58 void prepareAttributes(Map<QName, String> attributes, NormalizedNodeBuilder<P, ?, N> containerBuilder);