All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rt.storage.api.client.json.CustomizeJsonParser Maven / Gradle / Ivy

package com.rt.storage.api.client.json;

import com.rt.storage.api.client.util.Beta;
import java.lang.reflect.Field;
import java.util.Collection;

/**
 * {@link Beta} 
* Customizes the behavior of a JSON parser. * *

All methods have a default trivial implementation, so subclasses need only implement the * methods whose behavior needs customization. * *

Implementation has no fields and therefore thread-safe, but sub-classes are not necessarily * thread-safe. * * @since 1.0 * @author Yaniv Inbar */ @Beta public class CustomizeJsonParser { /** Returns whether to stop parsing at the given key of the given context object. */ public boolean stopAt(Object context, String key) { return false; } /** Called when the given unrecognized key is encountered in the given context object. */ public void handleUnrecognizedKey(Object context, String key) {} /** * Returns a new instance value for the given field in the given context object for a JSON array * or {@code null} for the default behavior. */ public Collection newInstanceForArray(Object context, Field field) { return null; } /** * Returns a new instance value for the given field class in the given context object for JSON * Object or {@code null} for the default behavior. */ public Object newInstanceForObject(Object context, Class fieldClass) { return null; } }