/*
 * Copyright 2015-2016 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 org.nanoframework.core.globals;

import java.util.concurrent.ConcurrentMap;

import com.google.common.collect.Maps;

/**
 * 全局变量，针对一些全局的属性做统一管理
 * 
 * @author yanghe
 * @since 1.0
 */
public class Globals {

    private static ConcurrentMap<Class<?>, Object> globals = Maps.newConcurrentMap();

    private Globals() {
    }

    public static void set(Class<?> clz, Object global) {
        globals.put(clz, global);
    }

    @SuppressWarnings("unchecked")
    public static final <T> T get(Class<T> clz) {
        return (T) globals.get(clz);
    }

}

@@ -764,20 +764,17 @@
 %E7%9A%84%E5%B1%9E%E6%80%A7%E5%81%9A%E7%BB%9F%E4%B8%80%E7%AE%A1%E7%90%86
-%0A * 
+.
 %0A * @aut
@@ -809,16 +809,22 @@
 %0Apublic 
+final 
 class Gl
@@ -831,17 +831,16 @@
 obals %7B%0A
-%0A
     priv
@@ -850,16 +850,22 @@
  static 
+final 
 Concurre
@@ -888,23 +888,23 @@
 Object%3E 
-globals
+GLOBALS
  = Maps.
@@ -944,24 +944,33 @@
 Globals() %7B%0A
+        %0A
     %7D%0A%0A    p
@@ -991,16 +991,22 @@
 oid set(
+final 
 Class%3C?%3E
@@ -1010,16 +1010,22 @@
 %3C?%3E clz,
+ final
  Object 
@@ -1042,23 +1042,23 @@
         
-globals
+GLOBALS
 .put(clz
@@ -1144,16 +1144,22 @@
 %3E T get(
+final 
 Class%3CT%3E
@@ -1185,23 +1185,23 @@
 urn (T) 
-globals
+GLOBALS
 .get(clz

update Globals