@Test public void nonExistentChildrenAreNavigable() { final NestedAttributesMap nonexistent = map.child("nonexistent"); assertThat(nonexistent, is(notNullValue())); assertThat(map.backing().isEmpty(), is(true)); }
@Override @SuppressWarnings("unchecked") public NestedAttributesMap child(final String name) { checkNotNull(name); Object child = backing.get(name); if (child == null) { child = ImmutableMap.of(); } else { checkState(child instanceof Map, "child '%s' not a Map", name); } return new ImmutableNestedAttributesMap(this, name, (Map<String, Object>) child); }
ImmutableNestedAttributesMap extends NestedAttributesMap { @Override @SuppressWarnings("unchecked") public NestedAttributesMap child(final String name) { checkNotNull(name); Object child = backing.get(name); if (child == null) { child = ImmutableMap.of(); } else { checkState(child instanceof Map, "child '%s' not a Map", name); } return new ImmutableNestedAttributesMap(this, name, (Map<String, Object>) child); } }
ImmutableNestedAttributesMap extends NestedAttributesMap { @Override @SuppressWarnings("unchecked") public NestedAttributesMap child(final String name) { checkNotNull(name); Object child = backing.get(name); if (child == null) { child = ImmutableMap.of(); } else { checkState(child instanceof Map, "child '%s' not a Map", name); } return new ImmutableNestedAttributesMap(this, name, (Map<String, Object>) child); } ImmutableNestedAttributesMap(@Nullable final NestedAttributesMap parent,
                                      final String key,
                                      final Map<String, Object> backing); }
ImmutableNestedAttributesMap extends NestedAttributesMap { @Override @SuppressWarnings("unchecked") public NestedAttributesMap child(final String name) { checkNotNull(name); Object child = backing.get(name); if (child == null) { child = ImmutableMap.of(); } else { checkState(child instanceof Map, "child '%s' not a Map", name); } return new ImmutableNestedAttributesMap(this, name, (Map<String, Object>) child); } ImmutableNestedAttributesMap(@Nullable final NestedAttributesMap parent,
                                      final String key,
                                      final Map<String, Object> backing); @Override @SuppressWarnings("unchecked") NestedAttributesMap child(final String name); }
ImmutableNestedAttributesMap extends NestedAttributesMap { @Override @SuppressWarnings("unchecked") public NestedAttributesMap child(final String name) { checkNotNull(name); Object child = backing.get(name); if (child == null) { child = ImmutableMap.of(); } else { checkState(child instanceof Map, "child '%s' not a Map", name); } return new ImmutableNestedAttributesMap(this, name, (Map<String, Object>) child); } ImmutableNestedAttributesMap(@Nullable final NestedAttributesMap parent,
                                      final String key,
                                      final Map<String, Object> backing); @Override @SuppressWarnings("unchecked") NestedAttributesMap child(final String name);  }