Subversion Repository Public Repository

litesoft

Diff Revisions 546 vs 547 for /trunk/GWT_Sandbox/MultiModule/anywhere/src/org/litesoft/sandbox/anywhere/util/UtilsCommon.java

Diff revisions: vs.
  @@ -27,4 +27,50 @@
27 27 }
28 28 return pValue;
29 29 }
30 +
31 + /**
32 + * This method strips the package name off the fully qualified class name of the pObject returning just the substring
33 + * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
34 + *
35 + * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
36 + */
37 + public static String justSimpleName( Object pObject )
38 + {
39 + return justSimpleName( (pObject != null) ? pObject.getClass() : null );
40 + }
41 +
42 + /**
43 + * This method strips the package name off the fully qualified class name of the pObject returning just the substring
44 + * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
45 + *
46 + * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
47 + */
48 + public static String justSimpleName( Class pClass )
49 + {
50 + return justSimpleName( (pClass != null) ? pClass.getName() : null );
51 + }
52 +
53 + /**
54 + * This method strips the package name off a fully qualified class name returning just the substring
55 + * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
56 + *
57 + * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
58 + */
59 + public static String justSimpleName( String pFullyQualifiedClassName )
60 + {
61 + int zAt = (pFullyQualifiedClassName != null) ? pFullyQualifiedClassName.lastIndexOf( '$' ) : -1;
62 + return (zAt != -1) ? pFullyQualifiedClassName.substring( zAt + 1 ) : justClassName( pFullyQualifiedClassName );
63 + }
64 +
65 + /**
66 + * This method strips the package name off a fully qualified class name returning just the substring
67 + * beginning one character beyond the last ".".
68 + *
69 + * @return the substring beginning one character beyond the last "."; null or no "." just returns pFullyQualifiedClassName
70 + */
71 + public static String justClassName( String pFullyQualifiedClassName )
72 + {
73 + int zAt = (pFullyQualifiedClassName != null) ? pFullyQualifiedClassName.lastIndexOf( '.' ) : -1;
74 + return (zAt != -1) ? pFullyQualifiedClassName.substring( zAt + 1 ) : pFullyQualifiedClassName;
75 + }
30 76 }