1 23 24 package com.sun.enterprise.admin.util; 25 28 public class Assert 29 { 30 33 static private final void 34 throwIt( String msg ) 35 { 36 AssertError e = new AssertError( msg ); 37 e.printStackTrace(); 39 throw e; 40 } 41 42 51 static public final void 52 assertit( boolean assertIsTrue, Object msg ) 53 { 54 if ( ! assertIsTrue ) 55 { 56 throwIt( msg.toString() ); 57 } 58 } 59 60 static public final void 61 assertRange( int value, int min, int max, Object msgIn ) 62 { 63 assertRange( (long)value, (long)min, (long)max, msgIn ); 64 } 65 66 67 static public final void 68 assertRange( long value, long min, long max, Object msgIn ) 69 { 70 if ( value < min || value > max ) 71 { 72 String rangeString = "[" + min + ", " + max + "]"; 73 String msg = "illegal integer value = " + value + 74 " must be in range " + rangeString; 75 76 if ( msgIn != null ) 77 { 78 msg += " ( " + msgIn + " )"; 79 } 80 81 throwIt( msg ); 82 } 83 } 84 }; 85 86 87 | Popular Tags |