org.xwiki.rendering.internal.block
Class ProtectedBlockFilter

java.lang.Object
  extended by org.xwiki.rendering.internal.block.ProtectedBlockFilter
All Implemented Interfaces:
BlockFilter

public class ProtectedBlockFilter
extends Object
implements BlockFilter

Used to manipulate Blocks but by filtering out protected blocks.

Note: This API is a work in progress and currently a protected block is a code macro marker block. In the future we need to make this more generic and since we also need to review Transformations to make them more performant this class may go away which is why it's currently located in an internal package.

Since:
2.6
Version:
$Id$

Constructor Summary
ProtectedBlockFilter()
           
 
Method Summary
 List<Block> filter(Block block)
          Filter provided block into zero or more block.
 List<Block> filter(List<Block> blocks)
           
<T extends Block>
List<T>
getChildrenByType(Block block, Class<T> blockClass, boolean recurse)
           
 Block getNextSibling(Block block)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtectedBlockFilter

public ProtectedBlockFilter()
Method Detail

filter

public List<Block> filter(Block block)
Filter provided block into zero or more block.

Specified by:
filter in interface BlockFilter
Parameters:
block - the block to filter.
Returns:
should never be null. The filtered blocks or empty list.
See Also:
BlockFilter.filter(org.xwiki.rendering.block.Block)

filter

public List<Block> filter(List<Block> blocks)
Parameters:
blocks - the blocks to filter
Returns:
the filtered blocks

getNextSibling

public Block getNextSibling(Block block)
Parameters:
block - the block to filter out
Returns:
the next sibling that is not a protected block or null if not found

getChildrenByType

public <T extends Block> List<T> getChildrenByType(Block block,
                                                   Class<T> blockClass,
                                                   boolean recurse)
Type Parameters:
T - the class of the Blocks to return
Parameters:
block - the block to filter out
blockClass - the type of Blocks to look for
recurse - if true also search recursively children
Returns:
the filtered blocks matching the passed Block class


Copyright © 2004-2011 XWiki. All Rights Reserved.