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

org.osgl.xls.HeaderTransformStrategy Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package org.osgl.xls;

/*-
 * #%L
 * Java Excel Reader
 * %%
 * Copyright (C) 2017 OSGL (Open Source General Library)
 * %%
 * 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.
 * #L%
 */

import org.osgl.$;
import org.osgl.Osgl;
import org.osgl.util.Keyword;

import java.util.Map;

public final class HeaderTransformStrategy {
    private HeaderTransformStrategy() {}

    public static $.Function AS_CAPTION = $.F.identity();

    public static $.Function TO_JAVA_NAME = transformTo(Keyword.Style.JAVA_VARIABLE);

    public static $.Function transformTo(final Keyword.Style style) {
        return new $.Transformer() {
            @Override
            public String transform(String s) {
                return style.toString(Keyword.of(s));
            }
        };
    }

    public static $.Function translate(final Map dictionary) {
        return new Osgl.Transformer() {
            @Override
            public String transform(String caption) {
                return dictionary.get(caption);
            }
        };
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy