Static Public Member Functions | |
Vector< Method > | availableMethods (Object obj, String prefix) |
Integer | getNextIndex (String col, String table) throws JetWebException |
String | unCamelMe (String input) |
Static Private Attributes | |
HashMap< String, HashMap< String, Vector< Method > > > | availableMethodsMap_ |
|
Definition at line 16 of file DBUtil.java. 00016 { 00017 00018 if(obj==null) return new Vector<Method>(0); 00019 00020 Vector<Method> methods; 00021 HashMap<String, Vector<Method> > foundMethods = 00022 availableMethodsMap_.get(obj.getClass().toString()); 00023 00024 boolean findMethods = false; 00025 boolean foundObject = false; 00026 00027 if(foundMethods==null){ 00028 findMethods = true; 00029 }else if(!foundMethods.containsKey(prefix)){ 00030 findMethods = true; 00031 foundObject = true; 00032 }else{ 00033 00034 methods = foundMethods.get(prefix); 00035 return(methods); 00036 } 00037 00038 methods = new Vector<Method>(); 00039 00040 if(findMethods){ 00041 Class objClass = obj.getClass(); 00042 Method[] objMethods = objClass.getMethods(); 00043 for(int ii=0; ii!= objMethods.length; ++ii){ 00044 if(objMethods[ii]. 00045 getName(). 00046 substring(0,prefix.length()). 00047 equals(prefix)){ 00048 methods.add(objMethods[ii]); 00049 } 00050 } 00051 00052 if(!foundObject){ 00053 foundMethods = new HashMap<String, Vector<Method> >(); 00054 } 00055 00056 foundMethods.put(prefix, methods); 00057 } 00058 00059 availableMethodsMap_.put(obj.getClass().toString(), foundMethods); 00060 00061 return(methods); 00062 }
|
|
Definition at line 65 of file DBUtil.java. 00066 { 00067 00068 String select = "SELECT MAX(" + col + ") FROM " + table; 00069 00070 Integer index = 1; 00071 00072 try{ 00073 Statement stmt = DBConfig.getConnection().createStatement(); 00074 ResultSet rs = stmt.executeQuery(select); 00075 00076 if(rs!=null && rs.next()){ 00077 index = rs.getInt(1); 00078 ++index; 00079 } 00080 }catch(SQLException err){ 00081 throw new JetWebException(err); 00082 } 00083 return index; 00084 }
|
|
Definition at line 86 of file DBUtil.java. 00086 { 00087 00088 String word = input; 00089 00090 for(int ii=0; ii< word.length()-1; ++ii){ 00091 char letter = word.charAt(ii); 00092 if(Character.isUpperCase(letter)){ 00093 String decapitalised = new String(); 00094 decapitalised += Character.toLowerCase(letter); 00095 if(ii!=0) decapitalised = "_"+decapitalised; 00096 word = word.substring(0,ii) + 00097 decapitalised+ 00098 word.substring(ii+1); 00099 00100 } 00101 } 00102 return(word); 00103 }
|
|
Initial value:
new HashMap<String HashMap<String Vector<Method> > >()
Definition at line 13 of file DBUtil.java. |
Generated Wed Jan 17 09:14:27 GMT 2007