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

ai.databand.parameters.StringArrayPreview Maven / Gradle / Ivy

There is a newer version: 1.0.26.1
Show newest version
/*
 * © Copyright Databand.ai, an IBM Company 2022
 */

package ai.databand.parameters;

import java.util.Collections;
import java.util.List;

public class StringArrayPreview implements TaskParameterPreview {

    @Override
    public String compact(String[] input) {
        if (input == null) {
            return "[]";
        }
        StringBuilder builder = new StringBuilder();
        builder.append("[");
        int idx = 0;
        for (String part : input) {
            if (builder.length() > 32) {
                builder.append("...");
                break;
            }
            builder.append(part);
            if (idx < input.length - 1) {
                builder.append(", ");
                idx++;
            }
        }
        builder.append("]");
        return builder.toString();
    }

    @Override
    public String full(String[] input) {
        if (input == null) {
            return "[]";
        }
        return String.join(", ", input);
    }

    @Override
    public String typeName(Class input) {
        return "String[]";
    }

    @Override
    public String schema(String[] input) {
        return "";
    }

    @Override
    public List dimensions(String[] input) {
        return Collections.emptyList();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy