diff options
author | 2016-04-12 10:13:14 +0200 | |
---|---|---|
committer | 2016-04-12 10:13:14 +0200 | |
commit | c7ca517b00f2682987aef3ac390dfc04155a8aee (patch) | |
tree | 662791d6e857234dab467d9cddd55300060ccaca /v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java | |
parent | 4a3dce3e0e59df4e091b4f8d4efc3e20831bf22f (diff) |
HONEYCOMB-9: Split impl module into smaller parts
Change-Id: I9232e0adfe611cb97951080839b28a7b62ba5484
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java')
-rw-r--r-- | v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java new file mode 100644 index 000000000..16808db1f --- /dev/null +++ b/v3po/vpp-facade-api/src/main/java/io/fd/honeycomb/v3po/vpp/facade/Context.java @@ -0,0 +1,49 @@ +/* + * 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.honeycomb.v3po.vpp.facade; + +import com.google.common.collect.Maps; +import java.util.HashMap; + +/** + * Simple context class that provides transient storage during one or more read/write operations + */ +public class Context implements AutoCloseable { + + protected final HashMap<Object, Object> map; + + public Context() { + map = Maps.newHashMap(); + } + + public Object get(final Object o) { + return map.get(o); + } + + public boolean containsKey(final Object o) { + return map.containsKey(o); + } + + public Object put(final Object o, final Object o2) { + return map.put(o, o2); + } + + @Override + public void close() { + map.clear(); + } +} |