blob: ac67130b97b674401a1bc3d0a47d531cc728e127 [file] [log] [blame]
Jian Licdbc0872016-12-05 17:23:53 +09001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.lisp.msg.protocols;
17
18/**
19 * A default implementation class of LispMapWithProxy interface.
20 */
21public final class DefaultLispProxyMapRecord implements LispProxyMapRecord {
22
23 private final LispMapRecord mapRecord;
24 private final boolean proxyMapReply;
25
26 private DefaultLispProxyMapRecord(LispMapRecord mapRecord, boolean proxyMapReply) {
27 this.mapRecord = mapRecord;
28 this.proxyMapReply = proxyMapReply;
29 }
30
31 @Override
32 public LispMapRecord getMapRecord() {
33 return mapRecord;
34 }
35
36 @Override
37 public boolean isProxyMapReply() {
38 return proxyMapReply;
39 }
40
41 /**
42 * A default builder class that builds MapWithProxy object.
43 */
44 public static final class DefaultMapWithProxyBuilder implements MapWithProxyBuilder {
45
46 private LispMapRecord mapRecord;
47 private boolean proxyMapReply;
48
49 @Override
50 public MapWithProxyBuilder withMapRecord(LispMapRecord mapRecord) {
51 this.mapRecord = mapRecord;
52 return this;
53 }
54
55 @Override
56 public MapWithProxyBuilder withIsProxyMapReply(boolean proxyMapReply) {
57 this.proxyMapReply = proxyMapReply;
58 return this;
59 }
60
61 @Override
62 public LispProxyMapRecord build() {
63 return new DefaultLispProxyMapRecord(mapRecord, proxyMapReply);
64 }
65 }
66}