com.lone.common.util.PublicUtil Maven / Gradle / Ivy
The newest version!
package com.lone.common.util;
import java.net.InetAddress;
import java.net.UnknownHostException;
import com.lone.common.core.reflect.ReflectHelper;
public class PublicUtil {
// public static void main(String[] args) {
// System.out.println("本机的ip=" + PublicUtil.getIp());
// }
public static String getPorjectPath() {
String nowpath = "";
nowpath = System.getProperty("user.dir") + "/";
return nowpath;
}
/**
* 获取本机ip
* @return
*/
public static String getIp() {
String ip = "";
try {
InetAddress inet = InetAddress.getLocalHost();
ip = inet.getHostAddress();
// System.out.println("本机的ip=" + ip);
} catch (UnknownHostException e) {
e.printStackTrace();
}
return ip;
}
/**
* 设置checkbox的值 -- Y/N
* @param obj
* @param params 以逗号隔开 "isNull,isShow,isQuery,isKey"
*/
public static void judgeCheckboxValue(Object obj,String params){
ReflectHelper reflectHelper=new ReflectHelper(obj);
String [] paramsArr = params.split(",");
for(int i = 0;i1){
s = s.substring(0, s.indexOf("where"));
}
return s.trim();
}
}