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) 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.util;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import javax.annotation.Resource;
import javax.xml.ws.WebServiceException;
/**
* Encapsulates which field/method the injection is done, and performs the
* injection.
*/
public abstract class InjectionPlan {
/**
* Perform injection
*
* @param instance
* Instance
* @param resource
* Resource
*/
public abstract void inject(T instance, R resource);
/**
* Perform injection, but resource is only generated if injection is
* necessary.
*
* @param instance
* @param resource
*/
public void inject(T instance, Callable resource) {
try {
inject(instance, resource.call());
} catch(Exception e) {
throw new WebServiceException(e);
}
}
/*
* Injects to a field.
*/
public static class FieldInjectionPlan extends
InjectionPlan {
private final Field field;
public FieldInjectionPlan(Field field) {
this.field = field;
}
public void inject(final T instance, final R resource) {
AccessController.doPrivileged(new PrivilegedAction