int (@Nullable CustomTemplateCallback callback) { TemplateImpl template = myTemplateToken.getTemplate(); if (template != null) { int result = template.getTemplateText().length(); for (Map.Entry<String, String> attribute : myTemplateToken.getAttributes().entrySet()) { result += attribute.getKey().length() + attribute.getValue().length() + 4; //plus space, eq, quotes } return result; } return 0; }