code: @Override
     public DirectoryResourceImpl getChildDirectory(final String name) throws ResourceException
     {
        Resource<?> result = getChild(name);
        if (!(result instanceof DirectoryResourceImpl))
        {
           if (result.exists())
           {
              throw new ResourceException("The resource [" + result.getFullyQualifiedName()
                       + "] is not a DirectoryResource");
           }
        }
  
        if (!(result instanceof DirectoryResourceImpl))
        {
           result = new DirectoryResourceImpl(getResourceFactory(), new File(getUnderlyingResourceObject()
                    .getAbsoluteFile(), name));
        }
        return (DirectoryResourceImpl) result;
     }
docs: Obtain a reference to the child {@link DirectoryResourceImpl}. If that resource does not exist, return a new
  instance. If the resource exists and is not a {@link DirectoryResourceImpl}, throw {@link ResourceException}