private void generateEnumEncoder(
        final StringBuilder sb,
        final String containingClassName,
        final CharSequence accessOrderListenerCall,
        final Token fieldToken,
        final String propertyName,
        final Token typeToken,
        final String indent)
    {
        if (!fieldToken.isConstantEncoding())
        {
            final String enumName = formatClassName(typeToken.applicableTypeName());
            final Encoding encoding = typeToken.encoding();
            final int offset = typeToken.offset();
            final String byteOrderString = byteOrderString(encoding);

            new Formatter(sb).format("\n" +
                indent + "    public %s %s(final %s value)\n" +
                indent + "    {\n" +
                "%s" +
                indent + "        %s;\n" +
                indent + "        return this;\n" +
                indent + "    }\n",
                formatClassName(containingClassName),
                propertyName,
                enumName,
                accessOrderListenerCall,
                generatePut(encoding.primitiveType(), "offset + " + offset, "value.value()", byteOrderString));
        }
    }
\n" +
                "     * Field presence indication. Can be optional, required, or constant.\n" +
                "
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaGenerator.java