javax.json.bind.serializer.DeserializationContext Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package javax.json.bind.serializer;
import javax.json.stream.JsonParser;
import java.lang.reflect.Type;
/**
* Provides JSONB Mapper functionality on top of JSONP parser.
*
* @see JsonbDeserializer
* @since JSON Binding 1.0
*/
public interface DeserializationContext {
/**
*
* Deserialize JSON stream into instance of provided class using {@link javax.json.stream.JsonParser}.
* JsonParser cursor have to be at KEY_NAME before START_OBJECT / START_ARRAY, or at START_OBJECT / START_ARRAY
* to call this method. After deserialization is complete JsonParser will be at END_OBJECT / END_ARRAY
* for deserialized JSON structure.
*
*
*
* If method is called for the same type, which is deserializer bound to, deserializer recursion is suppressed.
* Otherwise deserializers are reentrant during deserialization process started by this method.
*
*
* {@link JsonParser} instance of JSONB runtime is shared with custom deserializer.
*
* @param clazz
* Type to deserialize into. No arg constructor required.
* @param parser
* JSONP parser to drive.
* @param
* Type of class.
* @return Deserialized instance.
*/
T deserialize(Class clazz, JsonParser parser);
/**
*
* Deserialize JSON stream into instance of provided class using {@link javax.json.stream.JsonParser}.
* JsonParser cursor have to be at KEY_NAME before START_OBJECT / START_ARRAY, or at START_OBJECT / START_ARRAY
* to call this method. After deserialization is complete JsonParser will be at END_OBJECT / END_ARRAY
* for deserialized JSON structure.
*
*
*
* If method is called for the same type, which is deserializer bound to, deserializer recursion is suppressed.
* Otherwise deserializers are reentrant during deserialization process started by this method.
*
*
* {@link JsonParser} instance of JSONB runtime is shared with custom deserializer.
*
* @param type
* Type to deserialize into. No arg constructor required.
* @param parser
* JSONP parser to drive.
* @param
* Type to deserialize into.
* @return Deserialized instance.
*/
T deserialize(Type type, JsonParser parser);
}