Package org.xwiki.rendering.block.match
Class BlockNavigator
java.lang.Object
org.xwiki.rendering.block.match.BlockNavigator
Tool to navigate in a tree of blocks and extract them based on configurable criteria.
- Since:
- 5.0M1
- Version:
- $Id: e26c8beac34b7eb222b6cb8b1274e0cf20c98223 $
-
Constructor Summary
ConstructorsConstructorDescriptionThe default matcher does not filter anything.BlockNavigator(BlockMatcher matcher) -
Method Summary
Modifier and TypeMethodDescriptiongetBlocks(Block currentBlock, Block.Axes currentAxes) Get all blocks following providedBlockMatcherandBlock.Axes.<T extends Block>
TgetFirstBlock(Block currentBlock, Block.Axes currentAxes) Get the first matched block in the providedBlock.Axes.
-
Constructor Details
-
BlockNavigator
public BlockNavigator()The default matcher does not filter anything. -
BlockNavigator
- Parameters:
matcher- used to filter the result of the various methods
-
-
Method Details
-
getBlocks
Get all blocks following providedBlockMatcherandBlock.Axes.- Type Parameters:
T- the class of the Blocks to return- Parameters:
currentBlock- the block to start searching fromcurrentAxes- indicate the search axes- Returns:
- the matched
Blocks, empty list of none was found
-
getFirstBlock
Get the first matched block in the providedBlock.Axes.- Type Parameters:
T- the class of the Block to return- Parameters:
currentBlock- the block to start searching fromcurrentAxes- indicate the search axes- Returns:
- the matched
Block, null if none was found
-