containerwrapper.java

来自「一个非常好的FRAMWRK!是一个外国组织做的!不!」· Java 代码 · 共 117 行

JAVA
117
字号
/**
 * Copyright 2003-2005 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */

package com.jdon.container;

import java.util.List;

import com.jdon.aop.interceptor.InterceptorsChain;
import com.jdon.container.visitor.ComponentVisitor;
import com.jdon.controller.cache.InstanceCache;

/**
 * ContainerWrapper is main interface of jdonframework
 * 
 * @author banq
 */
public interface ContainerWrapper {

  /**
   * register a component class
   * @param name  component name
   * @param className component class  
   */
  public void register(String name, Class className);

  /**
   * register a component class with construtors of String type
   * @param name component name
   * @param className component class
   * @param constructors component construtor parameters
   */
  public void register(String name, Class className, String[] constructors);

  /**
   * register a component instance
   * @param name component name
   * @param instance component instance
   */
  public void register(String name, Object instance);
  
  /**
   * register a component, its class value is its name value 
   * 
   * @param name the name must be a class string
   */
  public void register(String name);  

  /**
   * start the container
   * this method will active all components's startup methods in container,
   * 
   */
  public void start();

  /**
   * stop the container
   * this method will active all components's stop methods in container.
   *
   */
  public void stop();

  /**
   * return all instances
   * @return all instances collection in container
   */
  public List getAllInstances();

  /**
   * get a component instance from container
   * @param name component name
   * @return  component single instance
   */
  public Object lookup(String name);
  
  /**
   * when access this method, will return a new component instance
   * it is difference with lookup method
   * @param name
   * @return a new component instance
   */
  public Object getComponentNewInstance(String name);
  
  /**
   * return a component class from container
   * @param name
   * @return component Class
   */
  public Class getComponentClass(String name);

  /**
   * register a child container
   * @param name
   */
  public void registerChild(String name);
  
  /**
   * get the child container
   * @param name
   * @return container
   */
  public ContainerWrapper getChild(String name);
    

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?