Util

Summary

The Util package contains some miscellaneous utilities.

Classes

MethodCheck

MethodCheck checks for the validity of arguments passed into methods. While the OSID Runtime also performs contract enforcement, it is often helpful to perform some of these checks in other methods to catch problems before reaching the OSID such as during the construction of an OsidObject. Checks include:

  • nullarg: checks that an argument is not null
  • cardinalarg: checks that an argument is greater than or equal to zero
  • cardinalrangearg: checks that two arguments are cardinals and the second is greater than or equal to the first
  • decimalrangearg: checks that the second of two decimals is greater than or equal to the first
  • integerrangearg: checks that the second of two integers is greater than or equal to the first
  • percentarg: checks that an argument is between 0-100 inclusive
import static net.okapia.osid.torrefacto.util.MethodCheck.nullarg;
 
void someMethod(org.osid.id.Id id, long startNumber, long endNumber) {
    nullarg(id, "someMethod id");
    cardinalRangeArg(startNumber, endNumber, "someMethod cardinal range");
}
    

StringUtil

Random String utilities for capitalization, selecting articles, etc.

AlphanumComparator

A Java java.util.Comparator for comparing numeric Strings.

See Also

Copyright © 2014 Okapia.