@@ -64,76 +64,68 @@ public static boolean sqlCheck (String t1, String t2) {
6464 && (t2 .equals (p_float ) || t2 .equals (t_float ) || t2 .equals (p_double ) || t2 .equals (t_double ));
6565 }
6666
67- public static synchronized int getTypeLength (String type , int l ) {
68- if (type .equals (p_byte )) {
69- return 1 ;
70- } else if (type .equals (p_char )) {
71- return 2 ;
72- } else if (type .equals (p_int )) {
73- return 4 ;
74- } else if (type .equals (p_long )) {
75- return 8 ;
76- } else if (type .equals (p_float )) {
77- return 4 ;
78- } else if (type .equals (p_double )) {
79- return 8 ;
80- } else if (type .equals (t_byte )) {
81- return 2 ;
82- } else if (type .equals (t_int )) {
83- return 5 ;
84- } else if (type .equals (c_int )) {
85- return 5 ;
86- } else if (type .equals (t_long )) {
87- return 9 ;
88- } else if (type .equals (c_long )) {
89- return 9 ;
90- } else if (type .equals (t_float )) {
91- return 5 ;
92- } else if (type .equals (t_double )) {
93- return 9 ;
94- } else if (type .equals (t_date )) {
95- return 9 ;
67+ public static int getTypeLength (String type ) {
68+ switch (type ) {
69+ case p_byte :
70+ return 1 ;
71+ case p_char :
72+ case t_byte :
73+ return 2 ;
74+ case p_int :
75+ case p_float :
76+ return 4 ;
77+ case p_long :
78+ case p_double :
79+ return 8 ;
80+ case t_int :
81+ case c_int :
82+ case t_float :
83+ return 5 ;
84+ case t_long :
85+ case c_long :
86+ case t_double :
87+ case t_date :
88+ return 9 ;
89+ default :
90+ return 0 ;
9691 }
97- return 0 ;
9892 }
9993
100- public static synchronized int getLength (Field f ) {
94+ public static int getLength (Field f ) {
10195 String type = f .getType ().getName ();
102- return getTypeLength (type , 0 );
96+ return getTypeLength (type );
10397 }
10498
105- public static synchronized boolean isVarType (String type ) {
106- return getTypeLength (type , 0 ) == 0 ;
99+ public static boolean isVarType (String type ) {
100+ return getTypeLength (type ) == 0 ;
107101 }
108102
109- public static synchronized boolean isVarType (Field f ) {
110- String type = f .getType ().getName ();
111- return isVarType (type );
103+ public static boolean isVarType (Field f ) {
104+ return isVarType (f .getType ().getName ());
112105 }
113106
114- public static synchronized boolean isObjType (Field f ) {
107+ public static boolean isObjType (Field f ) {
115108 return f .getType ().getName ().equals ("java.lang.Object" ) || f .getType ().getName ().equals ("su.interference.transport.TransportMessage" ) ||
116109 f .getType ().getName ().equals ("su.interference.transport.TransportEvent" ) || f .getType ().getName ().equals ("su.interference.transport.TransportCallback" ) ||
117110 f .getType ().getName ().equals ("su.interference.transport.TransportCallback" ) || f .getType ().getName ().equals ("su.interference.transport.EventResult" ) ||
118111 f .getType ().getName ().equals ("su.interference.sql.FrameApiJoin" );
119112 }
120113
121- public static synchronized boolean isPrimitiveType (String type ) {
122- if (type . equals ( "byte" ) ) {
123- return true ;
124- } else if ( type . equals ( "char" )) {
125- return true ;
126- } else if ( type . equals ( "int" )) {
127- return true ;
128- } else if ( type . equals ( "long" )) {
129- return true ;
130- } else if ( type . equals ( "float" )) {
131- return true ;
132- } else return type . equals ( "double" );
114+ public static boolean isPrimitiveType (String type ) {
115+ switch (type ) {
116+ case p_byte :
117+ case p_char :
118+ case p_int :
119+ case p_long :
120+ case p_float :
121+ case p_double :
122+ return true ;
123+ default :
124+ return false ;
125+ }
133126 }
134127
135- public static synchronized boolean isPrimitiveType (Field f ) {
136- String type = f .getType ().getName ();
137- return isPrimitiveType (type );
128+ public static boolean isPrimitiveType (Field f ) {
129+ return isPrimitiveType (f .getType ().getName ());
138130 }
139131}
0 commit comments