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.
package org.jvault.vault;
import org.jvault.annotation.Inject;
import org.jvault.exceptions.DisallowedAccessException;
import org.jvault.exceptions.NoDefinedInternalBeanException;
import org.jvault.factory.extensible.Vault;
import org.jvault.metadata.API;
import org.jvault.metadata.ThreadSafe;
import org.jvault.util.Reflection;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Parameter;
import java.util.List;
/**
* Receive instance of class as a parameter and inject bean to parameter.
*
* InstanceVault injects beans into parameters, using the @Inject annotation mapped to a field or constructor of the parameter's class.
* Examples.
*
* 1. Field Inject
*
* {@code
* public class Foo { @Inject private SomeBean bean; }
* }
*
* If a Foo instance is passed to a method of InstanceVault,
* InstanceVault injects a bean into the field mapped to @Inject of the created Foo instance.
*
* 2. Constructor Inject
*
* {@code
* public class Foo{
*
* private SomeBean bean;
*
* public Foo(){}
*
*· @Inject
* private Foo(@Inject("bean") SomeBean someBean){ }
* }
* }
*
* InstanceVault injects a value into the field based on the constructor parameter information mapped with @Inject of the passed parameter.
* Note that the constructor is not actually executed, and the bean is injected based on the parameter information of the constructor.
* and, the injected field is not mapped to the parameter name of the constructor,
* but is mapped to the value of the @Inject annotation marked on the parameter of the constructor.
*
* Also, constructor parameters must be marked with @Inject annotation. Otherwise, {@link org.jvault.exceptions.DuplicateInjectConstructorException} is thrown.
*
* InstanceVault can only be instantiated in the org.jvault.* package,
* and actually you can't force instantiation of Vault without using Reflection.
* To obtain InstanceVault, see the {@link org.jvault.factory.TypeVaultFactory} class.
*
* @author devxb
* @since 0.1
*/
@API
@ThreadSafe
public final class InstanceVault extends AbstractVault