@Test @SuppressWarnings("null") void testChild() { Resource parent = create(context.resourceResolver(), "/my/path", "/my/type"); Resource child1 = child(parent, "child1", "/my/child/type"); assertEquals("/my/path/child1", child1.getPath()); assertEquals("/my/child/type", child1.getResourceType()); Resource child2 = child(parent, "child2", "/my/child/type"); assertEquals("/my/path/child2", child2.getPath()); assertEquals("/my/child/type", child2.getResourceType()); List<Resource> childrenFromIterator = ImmutableList.copyOf(parent.listChildren()); List<Resource> childrenFromIterable = ImmutableList.copyOf(parent.getChildren()); assertEquals(childrenFromIterator, childrenFromIterable); assertEquals(2, childrenFromIterator.size()); assertTrue(parent.hasChildren()); assertEquals("/my/path/child1", parent.getChild("child1").getPath()); assertEquals("/my/path/child2", parent.getChild("child2").getPath()); assertNull(parent.getChild("child3")); }
public static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType) { return child(parentResource, name, resourceType, ValueMap.EMPTY); }
GraniteUiSyntheticResource extends SyntheticResource { public static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType) { return child(parentResource, name, resourceType, ValueMap.EMPTY); } }
GraniteUiSyntheticResource extends SyntheticResource { public static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType) { return child(parentResource, name, resourceType, ValueMap.EMPTY); } private  GraniteUiSyntheticResource(ResourceResolver resourceResolver,
      ResourceMetadata resourceMetadata, String resourceType,
      ValueMap props, Iterable<Resource> children); private  GraniteUiSyntheticResource(ResourceResolver resourceResolver,
      String path,
      String resourceType,
      ValueMap props,
      Iterable<Resource> children); }
GraniteUiSyntheticResource extends SyntheticResource { public static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType) { return child(parentResource, name, resourceType, ValueMap.EMPTY); } private  GraniteUiSyntheticResource(ResourceResolver resourceResolver,
      ResourceMetadata resourceMetadata, String resourceType,
      ValueMap props, Iterable<Resource> children); private  GraniteUiSyntheticResource(ResourceResolver resourceResolver,
      String path,
      String resourceType,
      ValueMap props,
      Iterable<Resource> children); @SuppressWarnings({ "unchecked", "null" }) @Override Type adaptTo(Class<Type> type); @Override Iterator<Resource> listChildren(); @Override Iterable<Resource> getChildren(); @Override boolean hasChildren(); @Override Resource getChild(String relPath); static Resource create(@NotNull ResourceResolver resourceResolver, @NotNull ValueMap valueMap); static Resource create(@NotNull ResourceResolver resourceResolver, @Nullable String path, @NotNull String resourceType); static Resource create(@NotNull ResourceResolver resourceResolver, @Nullable String path, @NotNull String resourceType,
      @NotNull ValueMap valueMap); static Resource wrap(@NotNull Resource resource); static Resource wrap(@NotNull Resource resource, @NotNull ValueMap valueMap); static Resource wrapMerge(@NotNull Resource resource, @NotNull ValueMap valueMap); static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType); static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType,
      @NotNull ValueMap valueMap); static void copySubtree(@NotNull Resource targetParent, @NotNull Resource source); }
GraniteUiSyntheticResource extends SyntheticResource { public static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType) { return child(parentResource, name, resourceType, ValueMap.EMPTY); } private  GraniteUiSyntheticResource(ResourceResolver resourceResolver,
      ResourceMetadata resourceMetadata, String resourceType,
      ValueMap props, Iterable<Resource> children); private  GraniteUiSyntheticResource(ResourceResolver resourceResolver,
      String path,
      String resourceType,
      ValueMap props,
      Iterable<Resource> children); @SuppressWarnings({ "unchecked", "null" }) @Override Type adaptTo(Class<Type> type); @Override Iterator<Resource> listChildren(); @Override Iterable<Resource> getChildren(); @Override boolean hasChildren(); @Override Resource getChild(String relPath); static Resource create(@NotNull ResourceResolver resourceResolver, @NotNull ValueMap valueMap); static Resource create(@NotNull ResourceResolver resourceResolver, @Nullable String path, @NotNull String resourceType); static Resource create(@NotNull ResourceResolver resourceResolver, @Nullable String path, @NotNull String resourceType,
      @NotNull ValueMap valueMap); static Resource wrap(@NotNull Resource resource); static Resource wrap(@NotNull Resource resource, @NotNull ValueMap valueMap); static Resource wrapMerge(@NotNull Resource resource, @NotNull ValueMap valueMap); static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType); static Resource child(@NotNull Resource parentResource, @NotNull String name, @NotNull String resourceType,
      @NotNull ValueMap valueMap); static void copySubtree(@NotNull Resource targetParent, @NotNull Resource source);  }