
cn.mybatisboost.util.SafeProperty Maven / Gradle / Ivy
The newest version!
package cn.mybatisboost.util;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public abstract class SafeProperty {
private static ConcurrentMap cache = new ConcurrentHashMap<>();
public static String[] of(Class> type, String... properties) {
cache.computeIfAbsent(new MultipleMapKey(type, properties), k -> {
for (String property : properties) {
try {
type.getDeclaredField(property);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
}
}
return true;
});
return properties;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy