info.magnolia.cms.util
Class SearchReplace

java.lang.Object
  extended by info.magnolia.cms.util.SearchReplace
All Implemented Interfaces:
ContentUtil.Visitor

public class SearchReplace
extends Object
implements ContentUtil.Visitor

A ContentUtil.Visitor which allows simple search/replace functionality. For sample usage, see SearchReplaceTest.

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Constructor Summary
SearchReplace(String propertyNamePattern, String search, String replace)
          A search and replace which searches for literal occurrences of search.
SearchReplace(String propertyNamePattern, String search, String replace, int regexFlags)
          A search and replace which can use parameterized substitution; use 0 for the default java.util.Pattern behavior.
 
Method Summary
protected  void onPropertyVisit(NodeData prop, int count, String oldValue, StringBuffer newValue)
           
 void visit(Content node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchReplace

public SearchReplace(String propertyNamePattern,
                     String search,
                     String replace)
A search and replace which searches for literal occurrences of search.

See Also:
Pattern.LITERAL

SearchReplace

public SearchReplace(String propertyNamePattern,
                     String search,
                     String replace,
                     int regexFlags)
A search and replace which can use parameterized substitution; use 0 for the default java.util.Pattern behavior.

Method Detail

visit

public void visit(Content node)
           throws Exception
Specified by:
visit in interface ContentUtil.Visitor
Throws:
Exception

onPropertyVisit

protected void onPropertyVisit(NodeData prop,
                               int count,
                               String oldValue,
                               StringBuffer newValue)


Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.