001// Licensed under the Apache License, Version 2.0 (the "License"); 002// you may not use this file except in compliance with the License. 003// You may obtain a copy of the License at 004// 005// http://www.apache.org/licenses/LICENSE-2.0 006// 007// Unless required by applicable law or agreed to in writing, software 008// distributed under the License is distributed on an "AS IS" BASIS, 009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 010// See the License for the specific language governing permissions and 011// limitations under the License. 012package org.apache.tapestry5.jacksondatabind.services; 013 014import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration; 015import org.apache.tapestry5.services.rest.MappedEntityManager; 016 017import com.fasterxml.jackson.databind.ObjectMapper; 018 019/** 020 * <p> 021 * Service that provides {@link ObjectMapper} instances for specific mapped entity classes. 022 * <p> 023 * <p> 024 * It's defined as an ordered configuration of {@link ObjectMapperSource} instances. 025 * Calls to {@link #get(Class)} will call the same method in contributed instances until 026 * one returns a non-null {@link ObjectMapper} instance. 027 * </p> 028 * @see ObjectMapper 029 * @see MappedEntityManager 030 * @since 5.8.0 031 */ 032@UsesOrderedConfiguration(ObjectMapperSource.class) 033public interface ObjectMapperSource 034{ 035 036 /** 037 * Provides the {@linkplain ObjectMapper} to be used for a given mapped entity class. 038 */ 039 ObjectMapper get(Class<?> clasz); 040 041}