Mercurial > projects > dwt2
comparison org.eclipse.equinox.common/src/org/eclipse/core/runtime/Assert.d @ 86:12b890a6392a
Work on databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 18 Apr 2009 13:58:35 +0200 |
parents | bc29606a740c |
children | bbe49769ec18 |
comparison
equal
deleted
inserted
replaced
85:6be48cf9f95c | 86:12b890a6392a |
---|---|
77 * @param object the value to test | 77 * @param object the value to test |
78 */ | 78 */ |
79 public static void isNotNull(Object object) { | 79 public static void isNotNull(Object object) { |
80 isNotNull(object, ""); //$NON-NLS-1$ | 80 isNotNull(object, ""); //$NON-NLS-1$ |
81 } | 81 } |
82 public static void isNotNull(String object) { | 82 public static void isNotNull(String str) { |
83 isTrue(object.ptr !is null); //$NON-NLS-1$ | 83 isTrue(str.ptr !is null); //$NON-NLS-1$ |
84 } | |
85 public static void isNotNull(void* ptr) { | |
86 isTrue(ptr !is null); //$NON-NLS-1$ | |
84 } | 87 } |
85 | 88 |
86 /** Asserts that the given object is not <code>null</code>. If this | 89 /** Asserts that the given object is not <code>null</code>. If this |
87 * is not the case, some kind of unchecked exception is thrown. | 90 * is not the case, some kind of unchecked exception is thrown. |
88 * The given message is included in that exception, to aid debugging. | 91 * The given message is included in that exception, to aid debugging. |
91 * @param message the message to include in the exception | 94 * @param message the message to include in the exception |
92 */ | 95 */ |
93 public static void isNotNull(Object object, String message) { | 96 public static void isNotNull(Object object, String message) { |
94 if (object is null) | 97 if (object is null) |
95 throw new AssertionFailedException("null argument:" ~ message); //$NON-NLS-1$ | 98 throw new AssertionFailedException("null argument:" ~ message); //$NON-NLS-1$ |
99 } | |
100 public static void isNotNull(String str, String message) { | |
101 isTrue(str.ptr !is null, message ); //$NON-NLS-1$ | |
102 } | |
103 public static void isNotNull(void* ptr, String message) { | |
104 isTrue(ptr !is null, message ); //$NON-NLS-1$ | |
96 } | 105 } |
97 | 106 |
98 /** Asserts that the given bool is <code>true</code>. If this | 107 /** Asserts that the given bool is <code>true</code>. If this |
99 * is not the case, some kind of unchecked exception is thrown. | 108 * is not the case, some kind of unchecked exception is thrown. |
100 * | 109 * |