From: <lh...@us...> - 2008-08-21 14:42:55
|
Revision: 142 http://tinytim.svn.sourceforge.net/tinytim/?rev=142&view=rev Author: lheuer Date: 2008-08-21 14:43:03 +0000 (Thu, 21 Aug 2008) Log Message: ----------- - More docs, Check is final, private constructor Modified Paths: -------------- tinytim/trunk/src/main/java/org/tinytim/internal/utils/Check.java Modified: tinytim/trunk/src/main/java/org/tinytim/internal/utils/Check.java =================================================================== --- tinytim/trunk/src/main/java/org/tinytim/internal/utils/Check.java 2008-08-21 14:35:44 UTC (rev 141) +++ tinytim/trunk/src/main/java/org/tinytim/internal/utils/Check.java 2008-08-21 14:43:03 UTC (rev 142) @@ -35,44 +35,93 @@ * @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a> * @version $Rev$ - $Date$ */ -public class Check { +public final class Check { - private static void _reportError(Construct sender, String msg) { + private Check() { + // noop. + } + + /** + * Throws a {@link ModelConstraintException} with the specified <tt>sender</tt> + * and <tt>msg</tt> + * + * @param sender The sender + * @param msg The error message + */ + private static void _reportError(final Construct sender, final String msg) { throw new ModelConstraintException(sender, msg); } - public static void scopeNotNull(Construct sender, Topic[] scope) { + /** + * Throws a {@link ModelConstraintException} if the <tt>scope</tt> is <tt>null</tt>. + * + * @param sender The sender + * @param scope The scope array. + */ + public static void scopeNotNull(final Construct sender, final Topic[] scope) { if (scope == null) { _reportError(sender, "The scope must not be null"); } } - public static void scopeNotNull(Construct sender, Collection<Topic> scope) { + /** + * Throws a {@link ModelConstraintException} if the <tt>scope</tt> is <tt>null</tt>. + * + * @param sender The sender + * @param scope A collection. + */ + public static void scopeNotNull(final Construct sender, final Collection<Topic> scope) { if (scope == null) { _reportError(sender, "The scope must not be null"); } } - public static void typeNotNull(Construct sender, Topic type) { + /** + * Throws a {@link ModelConstraintException} if the <tt>type</tt> is <tt>null</tt>. + * + * @param sender The sender + * @param type The topic to check. + */ + public static void typeNotNull(final Construct sender, final Topic type) { if (type == null) { _reportError(sender, "The type must not be null"); } } - public static void valueNotNull(Construct sender, Object value) { + /** + * Throws a {@link ModelConstraintException} if the <tt>value</tt> is <tt>null</tt>. + * + * @param sender The sender + * @param value The value. + */ + public static void valueNotNull(final Construct sender, final Object value) { if (value == null) { _reportError(sender, "The value must not be null"); } } - public static void valueNotNull(Construct sender, Object value, Locator datatype) { + /** + * Throws a {@link ModelConstraintException} if the <tt>value</tt> or + * <tt>datatype</tt> is <tt>null</tt>. + * + * @param sender The sender + * @param value The value. + * @param datatype The locator indicating the datatype. + */ + public static void valueNotNull(final Construct sender, final Object value, Locator datatype) { valueNotNull(sender, value); if (datatype == null) { _reportError(sender, "The datatype must not be null"); } } - public static void playerNotNull(Construct sender, Topic player) { + /** + * Throws a {@link ModelConstraintException} if the <tt>player</tt> is <tt>null</tt>. + * + * @param sender The sender + * @param player The topic to check. + */ + public static void playerNotNull(final Construct sender, final Topic player) { if (player == null) { _reportError(sender, "The role player must not be null"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |