com.authlete.jaxrs.util.JaxRsUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of authlete-java-jaxrs Show documentation
Show all versions of authlete-java-jaxrs Show documentation
Authlete library for JAX-RS (Java)
/*
* Copyright (C) 2017 Authlete, Inc.
*
* 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.authlete.jaxrs.util;
import java.util.Map;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
/**
* JAX-RS Utilities.
*
* @since 2.6
*/
public class JaxRsUtils
{
/**
* Create a {@code Map} instance from a
* {@code Map MultivaluedMap
createMultivaluedMap(Map data)
{
MultivaluedMap target
= new MultivaluedHashMap();
return putAll(target, data);
}
/**
* Put all entries in a {@code Map} instance
* into an existing {@code MultivaluedMap}.
*
* @param target
* Target {@code MultivaluedMap} instance.
*
* @param data
* Input data.
*
* @return
* The object given as {@code target}.
*/
public static MultivaluedMap
putAll(MultivaluedMap target, Map data)
{
if (target == null || data == null)
{
return target;
}
for (Map.Entry entry : data.entrySet())
{
target.addAll(entry.getKey(), entry.getValue());
}
return target;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy