protected static class DefaultJsonGenerator.ClosureConverter
A converter that handles converting a given type using a closure.
Modifiers | Name | Description |
---|---|---|
protected Closure<?> |
closure |
|
protected int |
paramCount |
|
protected Class<?> |
type |
Constructor and description |
---|
protected ClosureConverter(Class<?> type, Closure<?> closure) |
Type Params | Return Type | Name and description |
---|---|---|
|
public Object |
convert(Object value, String key) Converts a given value. |
|
public boolean |
equals(Object o) Any two Converter instances registered for the same type are considered to be equal. |
|
public boolean |
handles(Class<?> type) Returns true if this converter can handle conversions
of the given type. |
|
public int |
hashCode() |
|
public String |
toString() |
Converts a given value.
value
- the object to convertkey
- the key name for the value, may be null
Any 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 convertCopyright © 2003-2022 The Apache Software Foundation. All rights reserved.