com.citytechinc.aem.bedrock.api.node
Interface ComponentNode

All Superinterfaces:
Accessible, BasicNode, ImageSource, Inheritable, Linkable, Traversable<ComponentNode>

public interface ComponentNode
extends BasicNode, Inheritable, Traversable<ComponentNode>

Represents a "component" node in the JCR, typically an unstructured node in the hierarchy of a CQ page.

Many methods return an Optional type where a null instance would otherwise be returned.


Method Summary
 Optional<ComponentNode> getComponentNode(String relativePath)
          Get the component node for the resource at the given path relative to the current node.
 List<ComponentNode> getComponentNodes()
          Get a list of child nodes for the current node.
 List<ComponentNode> getComponentNodes(Predicate<ComponentNode> predicate)
          Get a predicate-filtered list of child nodes for the current node.
 List<ComponentNode> getComponentNodes(String relativePath)
          Get a list of child nodes for the resource at the given path relative to this node.
 List<ComponentNode> getComponentNodes(String relativePath, Predicate<ComponentNode> predicate)
          Get a list of child nodes for the resource at the given path relative to this node, returning only the nodes that meet the predicate criteria.
 List<ComponentNode> getComponentNodes(String relativePath, String resourceType)
          Get a list of child nodes for the resource at the given path relative to this node, returning only the nodes that have the specified resource type.
 Optional<BasicNode> getDesignNode()
          Get the design node for the current component.
 Optional<BasicNode> getNodeInherited(String relativePath)
          Get a child node relative to the current node, inheriting from a parent page if it does not exist.
 List<BasicNode> getNodesInherited(String relativePath)
          Get the children of a node relative to the current node.
 Optional<ComponentNode> getParent()
          Get the parent of this node.
 
Methods inherited from interface com.citytechinc.aem.bedrock.api.node.BasicNode
getId, getIndex, getIndex, getNode, getPath, getProperties, getResource
 
Methods inherited from interface com.citytechinc.aem.bedrock.api.Linkable
getHref, getHref, getLink, getLink, getLinkBuilder, getLinkBuilder
 
Methods inherited from interface com.citytechinc.aem.bedrock.api.ImageSource
getImageSource, getImageSource, getImageSource, getImageSource, isHasImage, isHasImage
 
Methods inherited from interface com.citytechinc.aem.bedrock.api.Accessible
asMap, get, get, getAsHref, getAsHref, getAsHref, getAsLink, getAsLink, getAsLink, getAsList, getAsPage, getAsType, getImageReference, getImageReference, getImageRendition, getImageRendition
 
Methods inherited from interface com.citytechinc.aem.bedrock.api.Inheritable
getAsHrefInherited, getAsHrefInherited, getAsHrefInherited, getAsLinkInherited, getAsLinkInherited, getAsLinkInherited, getAsListInherited, getAsPageInherited, getAsTypeInherited, getImageReferenceInherited, getImageReferenceInherited, getImageSourceInherited, getImageSourceInherited, getImageSourceInherited, getImageSourceInherited, getInherited, getInherited
 
Methods inherited from interface com.citytechinc.aem.bedrock.api.Traversable
findAncestor, findAncestorWithProperty, findAncestorWithPropertyValue, findDescendants
 

Method Detail

getComponentNode

Optional<ComponentNode> getComponentNode(String relativePath)
Get the component node for the resource at the given path relative to the current node.

Parameters:
relativePath - relative path to component
Returns:
Optional node for component

getComponentNodes

List<ComponentNode> getComponentNodes()
Get a list of child nodes for the current node.

Returns:
list of component nodes or empty list if none exist

getComponentNodes

List<ComponentNode> getComponentNodes(Predicate<ComponentNode> predicate)
Get a predicate-filtered list of child nodes for the current node.

Parameters:
predicate - predicate used to filter nodes
Returns:
list of component nodes that meet the predicate criteria or empty list if none exist

getComponentNodes

List<ComponentNode> getComponentNodes(String relativePath)
Get a list of child nodes for the resource at the given path relative to this node.

Parameters:
relativePath - relative path to parent of desired nodes
Returns:
list of component nodes below the specified relative path or empty list if none exist

getComponentNodes

List<ComponentNode> getComponentNodes(String relativePath,
                                      String resourceType)
Get a list of child nodes for the resource at the given path relative to this node, returning only the nodes that have the specified resource type.

Parameters:
relativePath - relative path to parent of desired nodes
resourceType - sling:resourceType of nodes to get from parent node
Returns:
list of component nodes matching the given resource type below the specified relative path or empty list if none exist

getComponentNodes

List<ComponentNode> getComponentNodes(String relativePath,
                                      Predicate<ComponentNode> predicate)
Get a list of child nodes for the resource at the given path relative to this node, returning only the nodes that meet the predicate criteria.

Parameters:
relativePath - relative path to parent of desired nodes
predicate - predicate used to filter nodes
Returns:
list of component nodes that meet the predicate criteria below the specified relative path or empty list if none exist

getDesignNode

Optional<BasicNode> getDesignNode()
Get the design node for the current component.

Returns:
Optional design node for the current style

getNodeInherited

Optional<BasicNode> getNodeInherited(String relativePath)
Get a child node relative to the current node, inheriting from a parent page if it does not exist.

Parameters:
relativePath - path relative to current node
Returns:
direct child node if it exists, otherwise the child node at this relative path for an ancestor page

getNodesInherited

List<BasicNode> getNodesInherited(String relativePath)
Get the children of a node relative to the current node. If node does not exist relative to current page, inherit from a parent page.

Parameters:
relativePath - path relative to current node
Returns:
list of nodes representing children of the addressed node or inherited from a parent page (or empty list if none exist)

getParent

Optional<ComponentNode> getParent()
Get the parent of this node.

Returns:
parent component node or absent optional if resource has no parent


Copyright © 2015 CITYTECH, Inc.. All rights reserved.