litesoft
Diff Revisions
803
vs
804
for /trunk/Java/core/Anywhere/src/org/litesoft/core/typeutils/Strings.java
|
@@ -403,4 +403,40 @@ |
403 |
403 |
|
} |
404 |
404 |
|
return sb.toString(); |
405 |
405 |
|
} |
|
406 |
+ |
|
|
407 |
+ |
public static String nullOKtoString( Object value ) |
|
408 |
+ |
{ |
|
409 |
+ |
return (value == null) ? null : value.toString(); |
|
410 |
+ |
} |
|
411 |
+ |
|
|
412 |
+ |
public static String nullToEmptytoString( Object value ) |
|
413 |
+ |
{ |
|
414 |
+ |
return (value == null) ? "" : value.toString(); |
|
415 |
+ |
} |
|
416 |
+ |
|
|
417 |
+ |
public static void nullOrEmptyOrSpace( String pErrorMessage, String pForm ) |
|
418 |
+ |
throws IllegalArgumentException |
|
419 |
+ |
{ |
|
420 |
+ |
error( pForm, pErrorMessage, " not allowed to be null or empty or have any spaces" ); |
|
421 |
+ |
} |
|
422 |
+ |
|
|
423 |
+ |
public static void nullOrEmpty( String pErrorMessage, String pForm ) |
|
424 |
+ |
throws IllegalArgumentException |
|
425 |
+ |
{ |
|
426 |
+ |
error( pForm, pErrorMessage, " not allowed to be null or empty" ); |
|
427 |
+ |
} |
|
428 |
+ |
|
|
429 |
+ |
public static void error( String pForm, String pErrorMessage, String pMessagePlus ) |
|
430 |
+ |
throws IllegalArgumentException |
|
431 |
+ |
{ |
|
432 |
+ |
if ( isNullOrEmpty( pErrorMessage ) ) |
|
433 |
+ |
{ |
|
434 |
+ |
pErrorMessage = pForm; |
|
435 |
+ |
} |
|
436 |
+ |
if ( -1 != pErrorMessage.indexOf( ' ' ) ) |
|
437 |
+ |
{ |
|
438 |
+ |
throw new IllegalArgumentException( pErrorMessage ); |
|
439 |
+ |
} |
|
440 |
+ |
throw new IllegalArgumentException( pErrorMessage + pMessagePlus ); |
|
441 |
+ |
} |
406 |
442 |
|
} |