package org.jcodegen.html.util;

import java.util.HashSet;
import java.util.Set;

/**
 * ...
 */
public class CssClasses {

    private final Set<String> classNames = new HashSet<String>();

    public void addClass(final String className) {
        classNames.add(className);
    }

    public String get() {
        if (classNames.isEmpty())
            return "";

        final StringBuilder buf = new StringBuilder();
        for (String className: classNames)
            buf.append(className).append(" ");
        buf.delete(buf.length() -1, buf.length());

        return buf.toString();
    }

    public void reset() {
        classNames.clear();
    }

    public int count() {
        return classNames.size();
    }
}

@@ -180,24 +180,562 @@
 String%3E();%0A%0A
+    public static CssClasses start(final String firstClass) %7B%0A        CssClasses cssClasses = new CssClasses();%0A        return cssClasses.add(firstClass);%0A    %7D%0A%0A    public CssClasses add(final String className) %7B%0A        if (className == null %7C%7C className.isEmpty())%0A            return this;%0A%0A        classNames.add(className);%0A%0A        return this;%0A    %7D%0A%0A    public CssClasses add(final String className, final boolean condition) %7B%0A        if (condition)%0A            return add(className);%0A%0A        return this;%0A    %7D%0A%0A    @Deprecated%0A
     public v
@@ -1259,11 +1259,78 @@
 );%0A    %7D
+%0A%0A    public boolean isEmpty() %7B%0A        return count() == 0;%0A    %7D
 %0A%7D%0A

Convert to fluent interface to make use easier and less verbose