ENDRPrint/.svn/pristine/46/46b1e12218e2c444f36a2e03d078451e6737bb05.svn-base
2024-08-14 10:33:27 +07:00

93 lines
1.8 KiB
Plaintext

package th.co.muangthai.endrprint.util.dbfactory;
/**
* Created by IntelliJ IDEA.
* User: ZIZU
* Date: 4/25/13
* Time: 4:02 PM
* To change this template use File | Settings | File Templates.
*/
public class MetaBean {
private String name;
private int length;
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public boolean isKey() {
return key;
}
public void setKey(boolean key) {
this.key = key;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
private String type;
private boolean key;
public String getNameHLower() {
String s[] = this.getName().split("_");
String nameTable = "";
String f = "";
String last = "";
for (int i = 0; i < s.length; i++) {
if (i == 0) {
f = s[i].substring(0, 1).toLowerCase();
} else if (i > 0) {
f = s[i].substring(0, 1).toUpperCase();
}
last = s[i].substring(1, s[i].length());
String token = f + last.toLowerCase();
nameTable += token;
}
return nameTable;
}
public String getNameHUpper() {
String s = getNameHLower();
return s.substring(0,1).toUpperCase() + s.substring(1);
}
public String getHibernateType()
{
if ("Date".equals(this.type))
{
return "timestamp";
}
if ("BigDecimal".equals(this.type))
{
return "big_decimal";
}
return this.type;
}
}