com.blade.ioc.SampleContainer Maven / Gradle / Ivy
/**
* Copyright (c) 2015, biezhi 王爵 ([email protected])
*
* 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.blade.ioc;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import blade.exception.BladeException;
import blade.kit.CloneKit;
import blade.kit.CollectionKit;
import blade.kit.StringKit;
import blade.kit.log.Logger;
import com.blade.annotation.Component;
import com.blade.annotation.Inject;
import com.blade.annotation.Path;
/**
* 默认的IOC容器实现
*
* @author biezhi
* @since 1.0
*/
@SuppressWarnings("unchecked")
public class SampleContainer implements Container {
private static final Logger LOGGER = Logger.getLogger(SampleContainer.class);
/**
* 保存所有bean对象 如:com.xxxx.User @Userx7asc
*/
private Map beans = CollectionKit.newConcurrentHashMap();
/**
* 存储所有的对象名和对于的类名关系
*/
private Map beanKeys = CollectionKit.newConcurrentHashMap();
/**
* 保存所有注解的class
*/
private Map, List