org.mule.common.metadata.parser.json
Class AbstractType

java.lang.Object
  extended by org.mule.common.metadata.parser.json.AbstractType
All Implemented Interfaces:
JSONType
Direct Known Subclasses:
JSONArrayType, JSONFileType, JSONObjectType, JSONResourceType, JSONType.BooleanType, JSONType.DoubleType, JSONType.Empty, JSONType.Everything, JSONType.IntegerType, JSONType.NumberType, JSONType.StringType

public abstract class AbstractType
extends Object
implements JSONType

Helper class for creation of new JSON types. Simply extend this class, and implement the contains method.

Author:
Timothy Danford

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mule.common.metadata.parser.json.JSONType
JSONType.BooleanType, JSONType.DoubleType, JSONType.Empty, JSONType.Everything, JSONType.IntegerType, JSONType.NumberType, JSONType.StringType
 
Constructor Summary
AbstractType()
           
 
Method Summary
abstract  boolean contains(Object o)
          The central method of JSONType; the type encompasses the values for which contains returns true.
 String explain(Object obj)
          Returns a non-null String explanation, suitable for display to a user, explaining why the given object fails to conform to the JSONType's contains method.
 boolean isOptional()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.common.metadata.parser.json.JSONType
isJSONArray, isJSONObject, isJSONPointer, isJSONPrimitive
 

Constructor Detail

AbstractType

public AbstractType()
Method Detail

contains

public abstract boolean contains(Object o)
Description copied from interface: JSONType
The central method of JSONType; the type encompasses the values for which contains returns true.

Specified by:
contains in interface JSONType
Returns:
trueif the given Object satisfies the type, false otherwise.

explain

public String explain(Object obj)
Description copied from interface: JSONType
Returns a non-null String explanation, suitable for display to a user, explaining why the given object fails to conform to the JSONType's contains method.

Specified by:
explain in interface JSONType
Returns:
an explanatory string if contains(arg) is false, or null if contains(arg) is true.

isOptional

public boolean isOptional()
Specified by:
isOptional in interface JSONType
Returns:
true if the type will accept "missing" (i.e. null) values, false otherwise.


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