org.mule.module.json.filters
Class IsJsonFilter

java.lang.Object
  extended by org.mule.module.json.filters.IsJsonFilter
All Implemented Interfaces:
Filter

public class IsJsonFilter
extends Object
implements Filter

A filter that will determine if the current message payload is a JSON encoded message.


Field Summary
protected  Log logger
          logger used by this class
 
Constructor Summary
IsJsonFilter()
           
 
Method Summary
 boolean accept(MuleMessage obj)
          Check a given message against this filter.
 boolean accept(Object obj)
           
 boolean isValidateParsing()
           
protected  boolean mayBeJSON(String string)
          Tests if the String possibly represents a valid JSON String.
 void setValidateParsing(boolean validateParsing)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger
logger used by this class

Constructor Detail

IsJsonFilter

public IsJsonFilter()
Method Detail

accept

public boolean accept(MuleMessage obj)
Description copied from interface: Filter
Check a given message against this filter.

Specified by:
accept in interface Filter
Parameters:
obj - a non null message to filter.
Returns:
true if the message matches the filter

accept

public boolean accept(Object obj)

isValidateParsing

public boolean isValidateParsing()

setValidateParsing

public void setValidateParsing(boolean validateParsing)

mayBeJSON

protected boolean mayBeJSON(String string)
Tests if the String possibly represents a valid JSON String.

Parameters:
string - Valid JSON strings are:
  • "null"
  • starts with "[" and ends with "]"
  • starts with "{" and ends with "}"
Returns:
true if the test string starts with one of the valid json characters


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.