private void block(BlockToken token) { String id = token.getId(); // Don't use the page element factory here becauses we need something that is both Block and // BodyPageElement and don't want to use casts. String description = id == null ? String.format("Anonymous within %s", loadingElement.getCompleteId()) : String.format("%s within %s", id, loadingElement.getCompleteId()); BlockImpl block = new BlockImpl(token.getLocation(), description); if (id != null) loadingElement.addBlock(id, block); setupBlock(block); }