Sets the specified instance for the given key (instance type).

@param type  instance type
@param value instance
@param <T>   type of the instance
@return this environment
437117
@SuppressWarnings("unchecked")
	public <T> DatagraphEnvironment setInstance(Class<T> type, T value) {
		((Map<Class<T>, T>) instances).put(type, value);
		return this;
	}
1170203
public void setTreeResource(String type, String value) {

        if (value == null) {
            return;
        }
        if (value.startsWith(CmsResource.VFS_FOLDER_SYSTEM + "/") && (!value.startsWith(m_currentSite))) {
            // restrict access to /system/
            value = "/";
        }
        m_treeType.put(type, value);
    }
351110
public void putEDBObjectEntry(String key, Object value, Class<?> type) {
        putEDBObjectEntry(key, value, type.getName());
    }
1368565
public Tree setType(Class<?> type) {
		if (value == null || value.getClass() == type) {
			return this;
		}
		value = DataConverterRegistry.convert(type, value);
		if (parent != null && key != null) {
			if (key instanceof String) {
				parent.putObjectInternal((String) key, value, false);
			} else {
				parent.remove((int) key);
				parent.insertObjectInternal((int) key, value);
			}
		}
		return this;
	}
60440
public <T> T get(String key, Class<T> type) {
        Object value = this.data.get(key);
        if (value != null && type.isAssignableFrom(value.getClass())) {
            return (T) value;
        }
        return null;
    }
592186
public void setType(String type) {
	property.setType(type);
	setDynamicAttribute(null, KeyConstants._type, type);
    }
1131581
public <T> void put(@NonNull String key, @NonNull T value, @NonNull TypeToken<T> typeTokenOfT) {
    Preconditions.checkNotNull(key, KEY_IS_NULL);
    Preconditions.checkNotNull(value, VALUE_IS_NULL);
    Preconditions.checkNotNull(typeTokenOfT, TYPE_TOKEN_OF_T_IS_NULL);

    if (!accessorProvider.getAccessors().containsKey(value.getClass())) {
      String jsonValue = jsonConverter.toJson(value, typeTokenOfT.getType());
      editor.putString(key, String.valueOf(jsonValue)).apply();
      return;
    }

    Class<?> classOfValue = value.getClass();

    for (Map.Entry<Class<?>, Accessor<?>> entry : accessorProvider.getAccessors().entrySet()) {
      if (classOfValue.equals(entry.getKey())) {
        @SuppressWarnings("unchecked") Accessor<T> accessor = (Accessor<T>) entry.getValue();
        accessor.put(key, value);
      }
    }
  }
1332993
public static <T> T newInstance(Type type) {
        try {
            Class<T> clazz = (Class<T>) getClass(type);
            if (clazz == null) {
                return null;
            }
            return clazz.newInstance();
        } catch (Exception e) {
            log.warn("new instance fail :{}", e.getCause().toString());
            throw new NewInstanceException(e.getCause().toString());
        }
    }
429588
public void setType(java.lang.String type) {
        getStateHelper().put(PropertyKeys.type, type);
        handleAttribute("type", type);
    }
1295679
final
  protected <T> T create(Class<T> type, InjectContext env)
    throws ConfigException
  {
    try {
      T value = type.newInstance();

      inject(value, env);
      
      return value;
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw ConfigException.wrap(e);
    }
  }
727659
public static <T,V extends Object> void type(V value, Class<T> type) {
		if(!validation) return;
		notNull(value);
		notNull(type);
		if(!type.isAssignableFrom(value.getClass())){
			throw new TypeException(type.getCanonicalName());
		}
	}
1247409
public void assignType(XAttribute attribute, String type) {
		if (type != null && type.trim().length() > 0) {
			XAttributeLiteral attr = (XAttributeLiteral) ATTR_TYPE.clone();
			attr.setValue(type);
			attribute.getAttributes().put(KEY_TYPE, attr);
		}
	}
942225
public <V> HMap put(TypeSafeKey<?, V> key, V value) {
        return alter(t -> t.put(key, view(key.mirror(), value)));
    }
1020766
public static <T> T convert(Type type, Object value, T defaultValue) throws ConvertException {
		return ConverterRegistry.getInstance().convert(type, value, defaultValue);
	}
763244
public void setType(final Type type) {
		getOrCreateComponentModel().type = type == null ? Type.TABLE : type;
	}
444815
public void setType(int type) {
        this.type = type;
        if (level == LEVEL_UNDEFINED) {
            switch (type) {
                case TYPE_INT:
                case TYPE_LONG:
                case TYPE_DOUBLE:
                    level = LEVEL_LOW;
                    break;
                case TYPE_STAT:
                    level = LEVEL_MEDIUM;
                    unit = "unit.ms";
                    break;
                case TYPE_LOAD:
                    level = LEVEL_HIGH;
                    break;
                case TYPE_SUBMODULE:
                    level = LEVEL_MAX;
                    break;
                default:
                    break;
            }
        }
    }
161519
public void setType(Type type) {
        Type actual = Type.preserveType(this.getType(), type);

        mConversions.clear();
        mExceptionPossible = false;
        if (actual != null) {
            // Prefer cast for initial type for correct operation of
            // setInitialType if a conversion needs to be inserted at the
            // beginning.
            mConversions.add(new Conversion(null, actual, true));
        }
    }