com.sun.xml.ws.client.sei.ValueSetter Maven / Gradle / Ivy
Show all versions of webservices-rt Show documentation
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.xml.ws.client.sei;
import com.sun.xml.ws.api.model.Parameter;
import com.sun.xml.ws.model.ParameterImpl;
import com.sun.xml.ws.spi.db.PropertyAccessor;
import jakarta.xml.ws.Holder;
import jakarta.xml.ws.WebServiceException;
import javax.xml.namespace.QName;
import jakarta.xml.bind.JAXBException;
/**
* Moves a Java value unmarshalled from a response message
* to the right place.
*
*
* Sometimes values are returned as a return value, and
* others are returned in the {@link Holder} value. Instances
* of this interface abstracts this detail.
*
*
* {@link ValueSetter} is a stateless behavior encapsulation.
*
* @author Kohsuke Kawaguchi
*/
public abstract class ValueSetter {
private ValueSetter() {}
/**
* Moves the value to the expected place.
*
* @param obj
* The unmarshalled object.
* @param args
* The arguments given to the Java method invocation. If {@code obj}
* is supposed to be returned as a {@link Holder} value, a suitable
* {@link Holder} is obtained from this argument list and {@code obj}
* is set.
*
* @return
* if {@code obj} is supposed to be returned as a return value
* from the method, this method returns {@code obj}. Otherwise null.
*/
abstract Object put(Object obj, Object[] args);
/**
* Singleton instance.
*/
private static final ValueSetter RETURN_VALUE = new ReturnValue();
/**
* {@link Param}s with small index numbers are used often,
* so we pool them to reduce the footprint.
*/
private static final ValueSetter[] POOL = new ValueSetter[16];
static {
for( int i=0; i