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

org.grails.web.converters.marshaller.ObjectMarshaller Maven / Gradle / Ivy

There is a newer version: 2023.0.2
Show newest version
/*
 * Copyright 2004-2022 the original author or authors.
 *
 * 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
 *
 *      https://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 org.grails.web.converters.marshaller;

import org.grails.web.converters.Converter;
import org.grails.web.converters.exceptions.ConverterException;

/**
 * An ObjectMarshaller is responsible for converting a Java/Groovy Object graph to a serialized form (JSON,XML).
 * 

* The ObjectMarshaller implementation must use a a type parameter - either grails.convereters.JSON or * grails.converters.XML and it should to be thread-safe. * * @author Siegfried Puchbauer * @since 1.1 */ @SuppressWarnings("rawtypes") public interface ObjectMarshaller { /** * Checks wheter the ObjectMarshaller is able/intended to support the given Object * * @param object the object which is about getting converted * @return true if the marshaller can/should perform the marshalling, false otherwise */ boolean supports(Object object); /** * Performs the conversion * @param object the object which is about getting converted * @param converter the Converter to use * @throws ConverterException on failure */ void marshalObject(Object object, T converter) throws ConverterException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy