Class AssertionExamples
java.lang.Object
net.jrodolfo.java_evolution.java04.assertions.AssertionExamples
Demonstrates assertions, introduced in J2SE 1.4.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanShows whether assertions are enabled for this class.normalizeUsername(String username) Uses ordinary validation for public input.intremainingCapacity(int available, int reserved) Uses an assertion for an internal invariant.
-
Constructor Details
-
AssertionExamples
public AssertionExamples()
-
-
Method Details
-
assertionsEnabled
public boolean assertionsEnabled()Shows whether assertions are enabled for this class.- Returns:
truewhen the JVM has enabled assertions for this class
-
remainingCapacity
public int remainingCapacity(int available, int reserved) Uses an assertion for an internal invariant.- Parameters:
available- the total capacity available to the componentreserved- the portion already reserved by earlier internal code- Returns:
- remaining capacity
-
normalizeUsername
-