* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.aai.serialization.db;
-import org.apache.tinkerpop.gremlin.structure.Direction;
+package org.onap.aai.serialization.db;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.tinkerpop.gremlin.structure.Direction;
+
public class EdgePropertyMap<K, V> extends HashMap<K, V> {
- private static final long serialVersionUID = -8298355506617458683L;
-
- private static final Pattern variablePattern = Pattern.compile("(!)?\\$\\{(\\w+)\\}");
-
- @Override
- public V get(Object arg0) {
-
- V value = super.get(arg0);
-
- Matcher m = variablePattern.matcher(value.toString());
- if (m.find()) {
- if (m.groupCount() == 2) {
- if (m.group(1) == null) {
- value = super.get(m.group(2));
- } else {
- value = reverse(super.get(m.group(2)));
- }
- }
- }
-
- return value;
- }
-
-
- protected V reverse(V value) {
-
- return (V)Direction.valueOf(value.toString()).opposite().toString();
- }
+ private static final long serialVersionUID = -8298355506617458683L;
+
+ private static final Pattern variablePattern = Pattern.compile("(!)?\\$\\{(\\w+)\\}");
+
+ @Override
+ public V get(Object arg0) {
+
+ V value = super.get(arg0);
+
+ Matcher m = variablePattern.matcher(value.toString());
+ if (m.find()) {
+ if (m.groupCount() == 2) {
+ if (m.group(1) == null) {
+ value = super.get(m.group(2));
+ } else {
+ value = reverse(super.get(m.group(2)));
+ }
+ }
+ }
+
+ return value;
+ }
+
+ protected V reverse(V value) {
+
+ return (V) Direction.valueOf(value.toString()).opposite().toString();
+ }
}