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

com.github.chengyuxing.sql.yaml.HyphenatedPropertyUtil Maven / Gradle / Ivy

Go to download

Light wrapper of JDBC, support ddl, dml, query, plsql/procedure/function, transaction and manage sql file.

There is a newer version: 9.0.2
Show newest version
package com.github.chengyuxing.sql.yaml;

import org.yaml.snakeyaml.introspector.Property;
import org.yaml.snakeyaml.introspector.PropertyUtils;

/**
 * Yaml hyphen properties tool.
 */
public class HyphenatedPropertyUtil extends PropertyUtils {
    @Override
    public Property getProperty(Class type, String name) {
        setSkipMissingProperties(true);
        return super.getProperty(type, camelize(name));
    }

    public static String camelize(String name) {
        int idx = name.indexOf("-");
        if (idx == -1) return name;
        if (idx + 1 >= name.length()) return name;
        String p = name.substring(idx, idx + 2);
        name = name.replace(p, p.substring(1).toUpperCase());
        return camelize(name);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy