package org.jcodegen.java;

import java.util.ArrayList;
import java.util.List;

/**
 * ...
 */
class StringOrCode<T> {
    private final String string;
    private final T code;

    StringOrCode(final String string) {
        this.string = string;
        code = null;
    }

    StringOrCode(final T code) {
        this.code = code;
        string = null;
    }

    static <T> List<String> getStrings(final List<StringOrCode<T>> alternatives) {
        List<String> strings = new ArrayList<String>();
        for (StringOrCode<T> alternative: alternatives)
            strings.add(alternative.toString());
        return strings;
    }

    @Override
    public String toString() {
        if (string == null)
            return code.toString();
        return string;
    }
}

@@ -88,16 +88,23 @@
 ...%0A */%0A
+public 
 class St
@@ -119,16 +119,17 @@
 de%3CT%3E %7B%0A
+%0A
     priv
@@ -180,24 +180,31 @@
  code;%0A%0A    
+public 
 StringOrCode
@@ -204,22 +204,16 @@
 gOrCode(
-final 
 String s
@@ -283,16 +283,23 @@
  %7D%0A%0A    
+public 
 StringOr
@@ -303,22 +303,16 @@
 gOrCode(
-final 
 T code) 
@@ -373,16 +373,23 @@
  %7D%0A%0A    
+public 
 static %3C
@@ -415,22 +415,16 @@
 Strings(
-final 
 List%3CStr
@@ -498,22 +498,16 @@
 rayList%3C
-String
 %3E();%0A   
@@ -635,24 +635,275 @@
 ngs;%0A    %7D%0A%0A
+    public boolean isString() %7B%0A        return code == null;%0A    %7D%0A%0A    public boolean isCode() %7B%0A        return string == null;%0A    %7D%0A%0A    public String getString() %7B%0A        return string;%0A    %7D%0A%0A    public T getCode() %7B%0A        return code;%0A    %7D%0A%0A
     @Overrid
@@ -1028,10 +1028,11 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A

Make StringOrCode class public and add some functions for use in client projects