class UserAndGroupReferenceResolver implements DocumentReferenceResolver<String> {

    public DocumentReference resolve(String documentReferenceRepresentation, Object... parameters)
    {
        if (parameters.length == 1 && !(parameters[0] instanceof String)) {
            throw new IllegalArgumentException("The resolver parameter is not a String.");
        }
        EntityReference defaultSpace;
        if (parameters.length == 1) {
            EntityReference defaultWiki = new EntityReference((String) parameters[0], EntityType.WIKI, null);
            defaultSpace = new EntityReference(DEFAULT_USER_SPACE, EntityType.SPACE, defaultWiki);
        } else {
            defaultSpace = resolver.resolve(DEFAULT_USER_SPACE, EntityType.SPACE);
        }
        return new DocumentReference(resolver.resolve(documentReferenceRepresentation,
                                                      EntityType.DOCUMENT,
                                                      defaultSpace));
    }

}