Subversion Repository Public Repository

litesoft

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

Diff revisions: vs.
  @@ -1,65 +1,65 @@
1 - package org.litesoft.sandbox.anywhere.util;
2 -
3 - public class UtilsCommon {
4 - public static <T> T deNull( T pValueToCheck, T pDefaultValue ) {
5 - return (pValueToCheck != null) ? pValueToCheck : pDefaultValue;
6 - }
7 -
8 - public static String noEmpty( String pValue ) {
9 - if ( pValue != null ) {
10 - if ( (pValue = pValue.trim()).length() == 0 ) {
11 - pValue = null;
12 - }
13 - }
14 - return pValue;
15 - }
16 -
17 - public static String assertNotEmpty( String pWhat, String pValue ) {
18 - if ( null == (pValue = noEmpty( pValue )) ) {
19 - throw new IllegalArgumentException( pWhat + " not allowed to be null or Empty!" );
20 - }
21 - return pValue;
22 - }
23 -
24 - /**
25 - * This method strips the package name off the fully qualified class name of the pObject returning just the substring
26 - * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
27 - *
28 - * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
29 - */
30 - public static String justSimpleName( Object pObject ) {
31 - return justSimpleName( (pObject != null) ? pObject.getClass() : null );
32 - }
33 -
34 - /**
35 - * This method strips the package name off the fully qualified class name of the pObject returning just the substring
36 - * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
37 - *
38 - * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
39 - */
40 - public static String justSimpleName( Class pClass ) {
41 - return justSimpleName( (pClass != null) ? pClass.getName() : null );
42 - }
43 -
44 - /**
45 - * This method strips the package name off a fully qualified class name returning just the substring
46 - * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
47 - *
48 - * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
49 - */
50 - public static String justSimpleName( String pFullyQualifiedClassName ) {
51 - int zAt = (pFullyQualifiedClassName != null) ? pFullyQualifiedClassName.lastIndexOf( '$' ) : -1;
52 - return (zAt != -1) ? pFullyQualifiedClassName.substring( zAt + 1 ) : justClassName( pFullyQualifiedClassName );
53 - }
54 -
55 - /**
56 - * This method strips the package name off a fully qualified class name returning just the substring
57 - * beginning one character beyond the last ".".
58 - *
59 - * @return the substring beginning one character beyond the last "."; null or no "." just returns pFullyQualifiedClassName
60 - */
61 - public static String justClassName( String pFullyQualifiedClassName ) {
62 - int zAt = (pFullyQualifiedClassName != null) ? pFullyQualifiedClassName.lastIndexOf( '.' ) : -1;
63 - return (zAt != -1) ? pFullyQualifiedClassName.substring( zAt + 1 ) : pFullyQualifiedClassName;
64 - }
65 - }
1 + package org.litesoft.sandbox.anywhere.util;
2 +
3 + public class UtilsCommon {
4 + public static <T> T deNull( T pValueToCheck, T pDefaultValue ) {
5 + return (pValueToCheck != null) ? pValueToCheck : pDefaultValue;
6 + }
7 +
8 + public static String noEmpty( String pValue ) {
9 + if ( pValue != null ) {
10 + if ( (pValue = pValue.trim()).length() == 0 ) {
11 + pValue = null;
12 + }
13 + }
14 + return pValue;
15 + }
16 +
17 + public static String assertNotEmpty( String pWhat, String pValue ) {
18 + if ( null == (pValue = noEmpty( pValue )) ) {
19 + throw new IllegalArgumentException( pWhat + " not allowed to be null or Empty!" );
20 + }
21 + return pValue;
22 + }
23 +
24 + /**
25 + * This method strips the package name off the fully qualified class name of the pObject returning just the substring
26 + * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
27 + *
28 + * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
29 + */
30 + public static String justSimpleName( Object pObject ) {
31 + return justSimpleName( (pObject != null) ? pObject.getClass() : null );
32 + }
33 +
34 + /**
35 + * This method strips the package name off the fully qualified class name of the pObject returning just the substring
36 + * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
37 + *
38 + * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
39 + */
40 + public static String justSimpleName( Class pClass ) {
41 + return justSimpleName( (pClass != null) ? pClass.getName() : null );
42 + }
43 +
44 + /**
45 + * This method strips the package name off a fully qualified class name returning just the substring
46 + * beginning one character beyond the last "." (And removes the wrapping Class names if Any).
47 + *
48 + * @return the substring beginning one character beyond the last "$"; null or no "$" just returns justClassName( pFullyQualifiedClassName )
49 + */
50 + public static String justSimpleName( String pFullyQualifiedClassName ) {
51 + int zAt = (pFullyQualifiedClassName != null) ? pFullyQualifiedClassName.lastIndexOf( '$' ) : -1;
52 + return (zAt != -1) ? pFullyQualifiedClassName.substring( zAt + 1 ) : justClassName( pFullyQualifiedClassName );
53 + }
54 +
55 + /**
56 + * This method strips the package name off a fully qualified class name returning just the substring
57 + * beginning one character beyond the last ".".
58 + *
59 + * @return the substring beginning one character beyond the last "."; null or no "." just returns pFullyQualifiedClassName
60 + */
61 + public static String justClassName( String pFullyQualifiedClassName ) {
62 + int zAt = (pFullyQualifiedClassName != null) ? pFullyQualifiedClassName.lastIndexOf( '.' ) : -1;
63 + return (zAt != -1) ? pFullyQualifiedClassName.substring( zAt + 1 ) : pFullyQualifiedClassName;
64 + }
65 + }