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

com.landawn.abacus.parser.Parser Maven / Gradle / Ivy

Go to download

A general programming library in Java/Android. It's easy to learn and simple to use with concise and powerful APIs.

There is a newer version: 5.3.16
Show newest version
/*
 * Copyright (C) 2015 HaiYang Li
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */

package com.landawn.abacus.parser;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;

import com.landawn.abacus.annotation.JsonXmlField;
import com.landawn.abacus.exception.UncheckedIOException;

/**
 * Design principles: 
  • 1, Simple (is beautiful)
  • 2, Fast (is powerful)
  • 3, Concepts (must be integral * and consistent)

  • * These principles can't be broken by any change or reason. And basically programmable is > configurable. There is no * extra support by configuration file or annotation. * * All the implementation should be multi-thread safety. * * @author Haiyang Li * @param * @param * @see JsonXmlField * @since 0.8 */ public interface Parser, DC extends DeserializationConfig> { /** * * @param obj * @return */ String serialize(Object obj); /** * * @param obj * @param config * @return */ String serialize(Object obj, SC config); /** * * @param output * @param obj * @throws UncheckedIOException the unchecked IO exception */ void serialize(File output, Object obj) throws UncheckedIOException; /** * * @param output * @param obj * @param config * @throws UncheckedIOException the unchecked IO exception */ void serialize(File output, Object obj, SC config) throws UncheckedIOException; /** * * @param output * @param obj * @throws UncheckedIOException the unchecked IO exception */ void serialize(OutputStream output, Object obj) throws UncheckedIOException; /** * * @param output * @param obj * @param config * @throws UncheckedIOException the unchecked IO exception */ void serialize(OutputStream output, Object obj, SC config) throws UncheckedIOException; /** * * @param output * @param obj * @throws UncheckedIOException the unchecked IO exception */ void serialize(Writer output, Object obj) throws UncheckedIOException; /** * * @param output * @param obj * @param config * @throws UncheckedIOException the unchecked IO exception */ void serialize(Writer output, Object obj, SC config) throws UncheckedIOException; /** * * @param * @param targetClass * @param source * @return */ T deserialize(Class targetClass, String source); /** * * @param * @param targetClass * @param source * @param config * @return */ T deserialize(Class targetClass, String source, DC config); /** * * @param * @param targetClass * @param source * @return * @throws UncheckedIOException the unchecked IO exception */ T deserialize(Class targetClass, File source) throws UncheckedIOException; /** * * @param * @param targetClass * @param source * @param config * @return * @throws UncheckedIOException the unchecked IO exception */ T deserialize(Class targetClass, File source, DC config) throws UncheckedIOException; /** * * @param * @param targetClass * @param source * @return * @throws UncheckedIOException the unchecked IO exception */ T deserialize(Class targetClass, InputStream source) throws UncheckedIOException; /** * * @param * @param targetClass * @param source * @param config * @return * @throws UncheckedIOException the unchecked IO exception */ T deserialize(Class targetClass, InputStream source, DC config) throws UncheckedIOException; /** * * @param * @param targetClass * @param source * @return * @throws UncheckedIOException the unchecked IO exception */ T deserialize(Class targetClass, Reader source) throws UncheckedIOException; /** * * @param * @param targetClass * @param source * @param config * @return * @throws UncheckedIOException the unchecked IO exception */ T deserialize(Class targetClass, Reader source, DC config) throws UncheckedIOException; }




    © 2015 - 2024 Weber Informatics LLC | Privacy Policy