class SpringInputCheckboxFieldTagProcessor
        extends AbstractSpringFieldTagProcessor {


    public static final String CHECKBOX_INPUT_TYPE_ATTR_VALUE = "checkbox";

    private final boolean renderHiddenMarkersBeforeCheckboxes;




    public SpringInputCheckboxFieldTagProcessor(final String dialectPrefix) {
        this(dialectPrefix, SpringStandardDialect.DEFAULT_RENDER_HIDDEN_MARKERS_BEFORE_CHECKBOXES);
    }


    public SpringInputCheckboxFieldTagProcessor(final String dialectPrefix, final boolean renderHiddenMarkersBeforeCheckboxes) {
        super(dialectPrefix, INPUT_TAG_NAME, TYPE_ATTR_NAME, new String[] { CHECKBOX_INPUT_TYPE_ATTR_VALUE }, true);
        this.renderHiddenMarkersBeforeCheckboxes = renderHiddenMarkersBeforeCheckboxes;
    }




    @Override
    protected void doProcess(final ITemplateContext context,
                             final IProcessableElementTag tag,
                             final AttributeName attributeName, final String attributeValue,
                             final IThymeleafBindStatus bindStatus, final IElementTagStructureHandler structureHandler) {<FILL_FUNCTION_BODY>}


    private final boolean isDisabled(final IProcessableElementTag tag) {
        // Disabled = attribute "disabled" exists
        return tag.hasAttribute(this.disabledAttributeDefinition.getAttributeName());
    }



}


        String name = bindStatus.getExpression();
        name = (name == null? "" : name);

        final String id = computeId(context, tag, name, true);

        String value = null;
        boolean checked = false;

        Object boundValue = bindStatus.getValue();
        final Class<?> valueType = bindStatus.getValueType();

        if (Boolean.class.equals(valueType) || boolean.class.equals(valueType)) {

            if (boundValue instanceof String) {
                boundValue = Boolean.valueOf((String) boundValue);
            }
            final Boolean booleanValue = (boundValue != null ? (Boolean) boundValue : Boolean.FALSE);
            value = "true";
            checked = booleanValue.booleanValue();

        } else {

            value = tag.getAttributeValue(this.valueAttributeDefinition.getAttributeName());
            if (value == null) {
                throw new TemplateProcessingException(
                        "Attribute \"value\" is required in \"input(checkbox)\" tags " +
                        "when binding to non-boolean values");
            }

            checked = SpringSelectedValueComparator.isSelected(bindStatus, HtmlEscape.unescapeHtml(value));

        }

        StandardProcessorUtils.setAttribute(structureHandler, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token
        StandardProcessorUtils.setAttribute(structureHandler, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token
        StandardProcessorUtils.setAttribute(
                structureHandler, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "checkbox"));
        if (checked) {
            StandardProcessorUtils.setAttribute(structureHandler, this.checkedAttributeDefinition, CHECKED_ATTR_NAME, CHECKED_ATTR_NAME);
        } else {
            structureHandler.removeAttribute(this.checkedAttributeDefinition.getAttributeName());
        }


        if (!isDisabled(tag)) {

            /*
             * Non-disabled checkboxes need an additional <input type="hidden"> in order to note their presence in
             * the HTML document. Given unchecked checkboxes are not sent by browsers as a result of form submission,
             * this is the only way to differentiate between a checkbox that is unchecked and a checkbox that was
             * never displayed or is disabled.
             */

            final IModelFactory modelFactory = context.getModelFactory();

            final IModel hiddenTagModel = modelFactory.createModel();

            final String hiddenName = WebDataBinder.DEFAULT_FIELD_MARKER_PREFIX + name;
            final String hiddenValue = "on";

            final Map<String,String> hiddenAttributes = new LinkedHashMap<String,String>(4,1.0f);
            hiddenAttributes.put(TYPE_ATTR_NAME, "hidden");
            hiddenAttributes.put(NAME_ATTR_NAME, hiddenName);
            hiddenAttributes.put(VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, hiddenName, hiddenValue, "hidden"));

            final IStandaloneElementTag hiddenTag =
                    modelFactory.createStandaloneElementTag(INPUT_TAG_NAME, hiddenAttributes, AttributeValueQuotes.DOUBLE, false, true);

            hiddenTagModel.add(hiddenTag);

            if (this.renderHiddenMarkersBeforeCheckboxes) {
                structureHandler.insertBefore(hiddenTagModel);
            } else {
                structureHandler.insertImmediatelyAfter(hiddenTagModel, false);
            }

        }


    
<methods>public void <init>(java.lang.String, java.lang.String, java.lang.String, java.lang.String[], boolean) ,public void setAttributeDefinitions(org.thymeleaf.engine.AttributeDefinitions) <variables>public static final java.lang.String ATTR_NAME,public static final int ATTR_PRECEDENCE,protected static final java.lang.String CHECKED_ATTR_NAME,protected static final java.lang.String DISABLED_ATTR_NAME,protected static final java.lang.String ID_ATTR_NAME,protected static final java.lang.String INPUT_TAG_NAME,protected static final java.lang.String MULTIPLE_ATTR_NAME,protected static final java.lang.String NAME_ATTR_NAME,protected static final java.lang.String OPTION_TAG_NAME,protected static final java.lang.String SELECTED_ATTR_NAME,protected static final java.lang.String SELECT_TAG_NAME,private static final org.thymeleaf.templatemode.TemplateMode TEMPLATE_MODE,protected static final java.lang.String TEXTAREA_TAG_NAME,protected static final java.lang.String TYPE_ATTR_NAME,protected static final java.lang.String VALUE_ATTR_NAME,protected org.thymeleaf.engine.AttributeDefinition checkedAttributeDefinition,protected org.thymeleaf.engine.AttributeDefinition disabledAttributeDefinition,private final non-sealed java.lang.String discriminatorAttrName,private final non-sealed java.lang.String[] discriminatorAttrValues,private org.thymeleaf.engine.AttributeDefinition discriminatorAttributeDefinition,protected org.thymeleaf.engine.AttributeDefinition idAttributeDefinition,protected org.thymeleaf.engine.AttributeDefinition multipleAttributeDefinition,protected org.thymeleaf.engine.AttributeDefinition nameAttributeDefinition,private final non-sealed boolean removeAttribute,protected org.thymeleaf.engine.AttributeDefinition selectedAttributeDefinition,protected org.thymeleaf.engine.AttributeDefinition typeAttributeDefinition,protected org.thymeleaf.engine.AttributeDefinition valueAttributeDefinition