public <T> T getAttribute(Key<T> key) {
    if (myAttributes != null){
      //noinspection unchecked
      return (T)myAttributes.get(key);
    }
    else {
      return null;
    }
  }
public <T> T getAttribute(Key<T> key)