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

org.jvault.bean.Bean Maven / Gradle / Ivy

package org.jvault.bean;

import org.jvault.metadata.InternalExtensiblePoint;

import java.util.*;

@InternalExtensiblePoint
public interface Bean {
     R loadIfInjectable(Class cls);
    boolean isInjectable(Class cls);

    abstract class Builder{

        private String name;
        private String[] accessPackages;
        private String[] accessClasses;
        private Object instance;
        private Map beans;

        public Builder name(String name){
            this.name = name;
            return this;
        }

        public Builder accessPackages(String... accessPackages){
            this.accessPackages = accessPackages;
            return this;
        }

        public Builder accessClasses(String... accessClasses){
            this.accessClasses = accessClasses;
            return this;
        }

        public Builder instance(Object instance){
            this.instance = instance;
            return this;
        }

        public Builder beans(Map beans){
            this.beans = beans;
            return this;
        }

        public String getName(){
            return name;
        }

        public String[] getAccessPackages(){
            return accessPackages;
        }

        public String[] getAccessClasses(){
            return accessClasses;
        }

        public Object getInstance(){
            return instance;
        }

        public Map getBeans(){
            return beans;
        }

        public S build(){
            return create();
        }

        protected abstract S create();

    }

}