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

db.sql.api.impl.tookit.SqlUtil Maven / Gradle / Ivy

There is a newer version: 1.7.6-RC2
Show newest version
package db.sql.api.impl.tookit;

import db.sql.api.Getter;

import java.lang.reflect.Field;

public final class SqlUtil {

    private static final String AS_SPLIT = "$$";

    public static  String getAsName(Getter getter) {
        LambdaUtil.LambdaFieldInfo lambdaFieldInfo = LambdaUtil.getFieldInfo(getter);
        return String.format("%s%s%s", lambdaFieldInfo.getType().getSimpleName(), AS_SPLIT, lambdaFieldInfo.getName());
    }

    public static String getFiledLambdaAsName(Field field) {
        return String.format("%s%s%s", field.getDeclaringClass().getSimpleName(), AS_SPLIT, field.getName());
    }

    public static String getAsName(Field field) {
        return String.format("%s%s%s", field.getDeclaringClass().getSimpleName(), AS_SPLIT, field.getName());
    }

    public static boolean isAsName(Field field, String name) {
        if (!name.contains(AS_SPLIT)) {
            return false;
        }
        return getAsName(field).equals(name);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy