Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2019, 2024 Oracle and/or its affiliates.
*
* 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 io.helidon.common.mapper;
import java.util.List;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.Set;
import io.helidon.common.GenericType;
import io.helidon.common.HelidonServiceLoader;
import io.helidon.common.Weighted;
import io.helidon.common.mapper.spi.MapperProvider;
/**
* Mapper manager of all configured mappers.
*
* To map a source to target, you can use either of the {@code map} methods defined in this interface,
* as they make sure that the mapping exists in either space.
*
*
If you call {@link #map(Object, Class, Class, String...)} and no mapper is found for the class pair,
* the implementation calls the {@link #map(Object, io.helidon.common.GenericType, io.helidon.common.GenericType, String...)}
* with {@link io.helidon.common.GenericType}s created for each parameters
*
If you call {@link #map(Object, io.helidon.common.GenericType, io.helidon.common.GenericType, String...)} and no mapper is
* found for the {@link io.helidon.common.GenericType} pair, an attempt is to locate a mapper for
* the underlying class *IF* the generic type represents a simple class (e.g. not a generic type declaration)
*
*/
public interface MapperManager {
/**
* Get an instance of the configured global manager. If none is explicitly set, an instance is created using
* discovered and built-in mappers.
*
* @return global mapper manager
*/
static MapperManager global() {
return GlobalManager.mapperManager();
}
/**
* Configure a new global mapper manager.
*
* @param manager mapper manager to use
*/
static void global(MapperManager manager) {
GlobalManager.mapperManager(manager);
}
/**
* Create a fluent API builder to create a customized mapper manager.
*
* @return a new builder
*/
static Builder builder() {
return new Builder();
}
/**
* Create a mapper manager using only Java Service loader
* loaded {@link io.helidon.common.mapper.spi.MapperProvider MapperProviders}.
*
* @return create a new mapper manager from service loader
*/
static MapperManager create() {
return MapperManager.builder().build();
}
/**
* Map from source to target.
*
* @param source object to map
* @param sourceType type of the source object (to locate the mapper)
* @param targetType type of the target object (to locate the mapper)
* @param qualifiers qualifiers of the usage (such as {@code http-headers, http}, most specific one first)
* @param