All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vaadin.flow.data.renderer.TemplateRenderer Maven / Gradle / Ivy

There is a newer version: 24.5.5
Show newest version
/*
 * Copyright 2000-2024 Vaadin Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.vaadin.flow.data.renderer;

import java.util.Objects;
import java.util.regex.Pattern;

import org.slf4j.LoggerFactory;

import com.vaadin.flow.function.SerializableConsumer;
import com.vaadin.flow.function.ValueProvider;
import com.vaadin.flow.internal.JsonSerializer;
import com.vaadin.flow.internal.UsageStatistics;

/**
 * Helper class to create {@link Renderer} instances, with fluent API.
 *
 * @author Vaadin Ltd
 *
 * @param 
 *            the type of the input object used inside the template
 *
 * @see #of(String)
 * @see https://www.polymer-project.org/2.0/docs/devguide/templates
 *
 * @deprecated since Vaadin 22, {@code TemplateRenderer} is deprecated in favor
 *             of {@link LitRenderer}
 */
@Deprecated
public final class TemplateRenderer extends Renderer {

    static {
        UsageStatistics.markAsUsed("flow-components/TemplateRenderer", null);
    }

    private static final Pattern BINDING_MISSING_DOLLAR = Pattern
            .compile("\\s(class|style)\\s*=\\s*['\"]?[{\\[]{2}");

    /**
     * Creates a new TemplateRenderer based on the provided template. The
     * template accepts anything that is allowed inside a {@code