diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2016-11-21 12:24:08 +0100 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2016-11-24 12:50:14 +0000 |
commit | 0d9be1f529fe370be518be823850ad186390ff46 (patch) | |
tree | 7985ff762b3aa212ea8137643107ddc0b8d8bf91 /lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/factory/MapResolverReaderFactory.java | |
parent | e259ab7990b8179eda4462907ecebccd0e85b587 (diff) |
HONEYCOMB-282 - Lisp factories refactoring
Refactoring to remove boilerplate code/for more readability
Change-Id: I1ed09160a183c748e698087edf57063e25e8d953
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/factory/MapResolverReaderFactory.java')
-rwxr-xr-x | lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/factory/MapResolverReaderFactory.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/factory/MapResolverReaderFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/factory/MapResolverReaderFactory.java new file mode 100755 index 000000000..b0c39291b --- /dev/null +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/factory/MapResolverReaderFactory.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.hc2vpp.lisp.translate.read.factory; + + +import io.fd.hc2vpp.lisp.translate.AbstractLispInfraFactoryBase; +import io.fd.hc2vpp.lisp.translate.read.MapResolverCustomizer; +import io.fd.honeycomb.translate.impl.read.GenericListReader; +import io.fd.honeycomb.translate.read.ReaderFactory; +import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureData; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolvers; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.MapResolversBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.map.resolvers.grouping.map.resolvers.MapResolver; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + + +/** + * Builds reader for {@link MapResolvers}<br> and all its inhired child readers + */ +public class MapResolverReaderFactory extends AbstractLispInfraFactoryBase implements ReaderFactory { + + @Override + public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) { + + InstanceIdentifier<MapResolvers> mapResolversInstanceIdentifier = + LISP_OPERATIONAL_IDENTIFIER.child(LispFeatureData.class).child(MapResolvers.class); + + registry.addStructuralReader(mapResolversInstanceIdentifier, MapResolversBuilder.class); + registry.add(new GenericListReader<>(mapResolversInstanceIdentifier.child(MapResolver.class), + new MapResolverCustomizer(vppApi))); + } +} |