I'm attempting to hold node properties in the following manner (this may be inherently wrong):

```
public class Property<T> {
    protected String key;
    protected T value;

    public Property(String key, T value) {
        this.key = key;
        this.value = value;
    }
}

public class Node {
    protected HashMap<String,Property> properties;

    public Node() {
        properties = new HashMap<>();
    }

```

However, this has the unfortunate side effect of making my a giant mess of casting. I've been reading everything that might be relevant, but nothing seems to address the essentail problem. Here's my current thought:

```
    public void add(String key, Object value) {
        if ( ! (value instanceof Property)) {
            value = new Property<>(key, value);
        }
        properties.put(key, (Property)value);
    }

    public long get(String key, long x) {
        return (long)properties.get(key).value;
    }
    public long[] get(String key, long[] x) {
        return (long[])properties.get(key).value;
    }
    public String get(String key, String x) {
        return (String)properties.get(key).value;
    }
    // etc

```

Now this is obviously incrediably stupid, but I'm going around in circles trying to simply be able to grab a node property by key, and be assured of it's type based on the key.

It's that simple. **A given key must correspond to a given type, both for adding and for getting**.

I honestly feel like I'm misunderstanding something fundamental about the nature of Java.