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

org.jvault.annotation.InternalBean Maven / Gradle / Ivy

package org.jvault.annotation;

import org.jvault.bean.Type;
import org.jvault.factory.extensible.Vault;
import org.jvault.metadata.API;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation that marks this class to be registered as a bean in {@link Vault}.

* * Below are the default settings of InternalBean.

* * Bean name : Same as changing the first alphabet of the class name to lowercase
* Bean {@link Type} : Bean is created as Singleton by default
* Bean accesses : Set to Empty String[] by default. In this case, this Bean can be injected from all packages *

* * Example code *
 * {@code @InternalBean(name = "example",
 *               type = Type.NEW,
 *               accessPackages = {"org.jvault.beans", "org.jvault.factory.*"},
 *               accessClasses = {"org.beanreader.AnnotatedBeanReader"})
 * public Class HelloWorld{}}
 * 
* then this Class will be registered bean as below info
* name : "example"
* type = Type.NEW
* accessPackages = {"org.jvault.beans", "org.jvault.factory.*"}
* accessClasses = {"org.beanreader.AnnotatedBeanReader"}

* * @see Inject * * @author devxb * @since 0.1 */ @API @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface InternalBean { /** * Specifies the name of the bean to be created.
* When this bean is injected, you need to write the name you specified here.

* * Default Bean name : Same as changing the first alphabet of the class name to lowercase * * @return String - bean name * * @author devxb * @since 0.1 */ String name() default ""; /** * Specifies the type of bean to be created. * * Default Bean {@link Type} : Bean is created as Singleton by default
* * @return {@link Type} * * @author devxb * @since 0.1 */ Type type() default Type.SINGLETON; /** * Specifies the package path into which this bean can be injected.
* This bean can be injected into all classes in the package.

* * If .* expression is used,
* this bean can be injected up to the leaf directory of all children including the preceding path.

*
* example1 : org.jvault.*
* All packages under org.jvault including the org.jvault package can receive this bean injection.

* * example2 : org.jvault.bean
* Only objects included in the org.jvault.bean package can receive this bean injection. *
* Set to Empty String[] by default.
* If both accessPackages() and accessClasses() are empty, this bean is accessible by all classes and packages. * * @return String[] Packages that can inject this bean * * @author devxb * @since 0.1 */ String[] accessPackages() default {}; /** * Specifies the Class name with path into which this bean can be injected.
* This bean can be injected into only class.

* * .* expression is not allowed.

* * Set to Empty String[] by default.
* If both accessPackages() and accessClasses() are empty, this bean is accessible by all classes and packages. * * @return String[] Class name with path that can inject this bean */ String[] accessClasses() default {}; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy