protected static class DefaultJsonGenerator.ClosureConverter
A converter that handles converting a given type to a JSON value using a closure.
| Modifiers | Name | Description |
|---|---|---|
protected groovy.lang.Closure<?> |
closure |
|
protected int |
paramCount |
|
protected java.lang.Class<?> |
type |
| Constructor and description |
|---|
protected DefaultJsonGenerator.ClosureConverter
(java.lang.Class<?> type, groovy.lang.Closure<?> closure) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
java.lang.Object |
convert(java.lang.Object value, java.lang.String key)Converts a given value. |
|
boolean |
equals(java.lang.Object o)Any two Converter instances registered for the same type are considered to be equal. |
|
boolean |
handles(java.lang.Class<?> type)Returns true if this converter can handle conversions
of the given type. |
|
int |
hashCode() |
|
java.lang.String |
toString() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Converts a given value.
value - the object to convertkey - the key name for the value, may be nullAny two Converter instances registered for the same type are considered to be equal. This comparison makes managing instances in a Set easier; since there is no chaining of Converters it makes sense to only allow one per type.
o - the object with which to compare.true if this object contains the same class; false otherwise. Returns true if this converter can handle conversions
of the given type.
type - the type of the object to convert