Package jodd.petite

Class PetiteContainer

    • Method Detail

      • getBean

        public <T> T getBean​(java.lang.Class<T> type)
        Returns Petite bean instance. Bean name will be resolved from provided type.
      • getBean

        protected java.lang.Object getBean​(BeanReferences beanReferences)
        Returns Petite bean instance named as one of the provided names. Returns null if bean is not found.
      • getBean

        public <T> T getBean​(java.lang.String name)
        Returns Petite bean instance. Petite container will find the bean in corresponding scope and all its dependencies, either by constructor or property injection. When using constructor injection, cyclic dependencies can not be prevented, but at least they are detected.
        See Also:
        createBean(Class)
      • initBeanDefinition

        protected void initBeanDefinition​(BeanDefinition def)
        Resolves and initializes bean definition. May be called multiple times.
      • registerBeanAndWireAndInjectParamsAndInvokeInitMethods

        protected void registerBeanAndWireAndInjectParamsAndInvokeInitMethods​(BeanData beanData)
        Wires bean, injects parameters and invokes init methods. Such a loooong name :)
      • wire

        public void wire​(java.lang.Object bean)
        Wires provided bean with the container using default wiring mode. Bean is not registered withing container.
      • wire

        public void wire​(java.lang.Object bean,
                         WiringMode wiringMode)
        Wires provided bean with the container and optionally invokes init methods. Bean is not registered withing container.
      • invokeMethod

        public <T> T invokeMethod​(java.lang.Object bean,
                                  java.lang.reflect.Method method)
        Invokes the method of some bean with the container, when its parameters requires to be injected into. The bean is not registered within container.
      • createBean

        public <E> E createBean​(java.lang.Class<E> type)
        Creates and wires a bean within the container using default wiring mode and default init methods flag. Bean is not registered.
      • createBean

        public <E> E createBean​(java.lang.Class<E> type,
                                WiringMode wiringMode)
        Creates and wires a bean within the container and optionally invokes init methods. However, bean is not registered.
      • invokeProvider

        protected java.lang.Object invokeProvider​(ProviderDefinition provider)
        Invokes provider to get a bean.
      • addBean

        public void addBean​(java.lang.String name,
                            java.lang.Object bean)
        Adds object instance to the container as singleton bean using default wiring mode and default init method flag.
      • addBean

        public void addBean​(java.lang.String name,
                            java.lang.Object bean,
                            WiringMode wiringMode)
        Adds object instance to the container as singleton bean.
      • addSelf

        public void addSelf​(java.lang.String name)
        Adds self instance to the container so internal beans may fetch container for further usage. No wiring is used and no init methods are invoked.
      • addSelf

        public void addSelf()
        Adds self instance to the container so internal beans may fetch container for further usage. No wiring is used and no init methods are invoked.
      • setBeanProperty

        public void setBeanProperty​(java.lang.String name,
                                    java.lang.Object value)
        Sets petite bean property.
      • getBeanProperty

        public java.lang.Object getBeanProperty​(java.lang.String name)
        Returns petite bean property value.
      • shutdown

        public void shutdown()
        Shutdowns container. After container is down, it can't be used anymore.