@Override
    @SuppressWarnings("unchecked")
    public <T> T getObject(String name, Class<T> requiredType) throws RequiredTypeException {
        if (name == null) {
            throw new NullPointerException("name parameter cannot be null.");
        }
        if (requiredType == null) {
            throw new NullPointerException("requiredType parameter cannot be null.");
        }
        Object o = this.objects.get(name);
        if (o == null) {
            return null;
        }
        if (!requiredType.isInstance(o)) {
            String msg = "Object named '" + name + "' (of type [" + o.getClass().getName() + "]) is not of required type ["
                    + requiredType.getName() + "].";
            throw new RequiredTypeException(msg);
        }
        return (T) o;
    }
Returns the live (modifiable) internal objects collection.

@return the live (modifiable) internal objects collection.
core/src/main/java/org/apache/shiro/env/DefaultEnvironment.java