code: @Override
     @SuppressWarnings("unchecked")
     public <E, T extends Resource<E>> T getChildOfType(final Class<T> type, final String name) throws ResourceException
     {
        T result;
        Resource<?> child = getChild(name);
        if (type.isAssignableFrom(child.getClass()))
        {
           result = (T) child;
        }
        else if (child.exists())
        {
           throw new ResourceException("Requested resource [" + name + "] was not of type [" + type.getName()
                    + "], but was instead [" + child.getClass().getName() + "]");
        }
        else
        {
           E underlyingResource = (E) child.getUnderlyingResourceObject();
           result = getResourceFactory().create(type, underlyingResource);
        }
        return result;
     }
docs: Using the given type, obtain a reference to the child resource of the given type. If the result is not of the
  requested type and does not exist, return null. If the result is not of the requested type and exists, throw
  {@link ResourceException}