Skip to content

Commit

Permalink
Merge pull request #31 from theangrydev/master
Browse files Browse the repository at this point in the history
Make NiceMap methods non-final so that they can be overridden
  • Loading branch information
danielbodart committed Mar 24, 2016
2 parents 7f13c3f + 61be59f commit e1f5259
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/com/googlecode/yatspec/state/givenwhenthen/NiceMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public NiceMap(Object... instances) {
}
}

public final <R> R getType(String key, Class<R> aClass) {
public <R> R getType(String key, Class<R> aClass) {
Object value = map.get(key);
if(value == null) {
return null;
Expand All @@ -27,37 +27,37 @@ public final <R> R getType(String key, Class<R> aClass) {
return (R) value;
}

public final Map<String, Object> getTypes() {
public Map<String, Object> getTypes() {
synchronized (map) {
return unmodifiableMap(new LinkedHashMap<String, Object>(map));
}
}

public final <R> R getType(Class<R> aClass) {
public <R> R getType(Class<R> aClass) {
return getType(defaultName(aClass), aClass);
}

public final T add(String key, Object instance){
public T add(String key, Object instance){
map.put(key, instance);
return (T) this;
}

public final boolean isEmpty() {
public boolean isEmpty() {
return map.isEmpty();
}

public final T add(Object instance){
public T add(Object instance){
if(instance == null) {
return (T) this;
}
return add(defaultName(instance.getClass()), instance);
}

public final boolean contains(Class aClass){
public boolean contains(Class aClass){
return contains(defaultName(aClass));
}

public final boolean contains(String name) {
public boolean contains(String name) {
return map.containsKey(name);
}

Expand Down

0 comments on commit e1f5259

Please sign in to comment.