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

com.sun.xml.ws.client.sei.ValueGetter Maven / Gradle / Ivy

There is a newer version: 4.0.4
Show newest version
/*
 * Copyright (c) 1997, 2019 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 javax.jws.WebParam.Mode;
import javax.xml.ws.Holder;

/**
 * Gets a value from an object that represents a parameter passed
 * as a method argument.
 *
 * 

* This abstraction hides the handling of {@link Holder}. * *

* {@link ValueGetter} is a stateless behavior encapsulation. * * @author Kohsuke Kawaguchi */ enum ValueGetter { /** * {@link ValueGetter} that works for {@link Mode#IN} parameter. * *

* Since it's the IN mode, the parameter is not a {@link Holder}, * therefore the parameter itself is a value. */ PLAIN() { Object get(Object parameter) { return parameter; } }, /** * Creates {@link ValueGetter} that works for {@link Holder}, * which is {@link Mode#INOUT} or {@link Mode#OUT}. * *

* In those {@link Mode}s, the parameter is a {@link Holder}, * so the value to be sent is obtained by getting the value of the holder. */ HOLDER() { Object get(Object parameter) { if(parameter==null) // the user is allowed to pass in null where a Holder is expected. return null; return ((Holder)parameter).value; } }; /** * Gets the value to be sent, from a parameter given as a method argument. * @param parameter that is passed by proxy * @return if it holder then its value, otherise parameter itself */ abstract Object get(Object parameter); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy