JOpt Simple is my Java library for parsing command line options. You can find the changes in this latest release here.
This release incorporates a couple of smaller features.
Happy parsing!
JOpt Simple is my Java library for parsing command line options. You can find the changes in this latest release here.
This release incorporates a couple of smaller features.
Happy parsing!
JOpt Simple is my Java library for parsing command line options. You can find the changes in this latest release here.
This release incorporates a small API change to produce a list of OptionSpecs that correspond to the options detected on a parse, in the order in which the options occurred on the command line.
Happy parsing!
JOpt Simple is my Java library for parsing command line options. You can find the changes in this latest release here.
This release incorporates a small API change to allow compile-time arrays as the supplier of default values for an argument-accepting option, as well as removing some internal unused methods and classes.
Happy parsing!
Repo is here. I didn't carry previous CVS history with me. Currently toying with the idea of allowing alternative help formatters for a next release. Will move website at some point also.
By now you surely know that Java's generics info is erased from objects during compilation. For example, given an object whose runtime class is java.util.List, I cannot tell at runtime whether the object was originally a List<Integer>, or a List<String>, or what have you.
However, Java has some generics capability using reflection. There are generics-aware counterparts to the generics-unaware reflection capabilities that Java has had for so long. Given a method or constructor, you can discover the types of its parameters. Given a method, you can discover its return type. Given a field, you can discover its type. Given a class or interface, you can discover its superclass, implemented interfaces, or superinterfaces.
The generics-aware reflection capabilities deal not in java.lang.Class objects, but in instances of java.lang.reflect.Type. Type by itself is not terribly useful: it prescribes no methods! To do meaningful work with Types, you have to test whether they're instances of either Class, ParameterizedType, WildcardType, GenericArrayType, or TypeVariable, and downcast. Worse still, if your Type is not a Class, you miss out on nice things you can ask Classes, such as isAssignableFrom().
Not a big deal, perhaps, until you work on a library or extension that could put the generics info to good use.
Enter javaRuntype. This fantastic library does the dirty work of providing Class-like functionality such as isAssignableFrom() for you. Kudos to Daniel Fernandez for his attempt to rescue java.lang.reflect.Type and its brethren from second-class citizen status.
Save the date: Feb 25 2011, in Houston, the AgileDotNet conference. Lots of great speakers and topics -- this is a high value-for-dollar event. Sign up before Dec 1 2010 with the discount code EARLYBIRD and get a good break on the already low registration fee. This is one of the many excellent events held by Improving Enterprises. Don't miss it!
QuickCheck is a neat Haskell tool for specifying properties that should hold for functions and firing lots of random inputs into those functions to test that the properties hold true. JUnit's answer to such properties is the notion of "theories." Using some annotations and ParameterSuppliers, it should be possible to generate some number of random values for theory parameters. To test this out, I've started a project on GitHub called junit-quickcheck. It's rather embryonic at this point, but I hope to grow it into something lots of people can benefit from.
A quick example:
@RunWith(Theories.class)
public class AbsoluteValue {
// fire 100 random ints at the theory
@Theory
public void isAdditiveInverse(@ForAll int i) {
assumeThat(i, lessThan(0));
assertEquals(-i, Math.abs(i));
}
}
What about remembering previously successful/failed values? Restricting/broadened sample size? So many possibilities...
Go check it out! I appreciate any and all constructive feedback.
Changes are here. Biggest change is to admit sources of property configuration other than Properties and string-to-string Maps. Enjoy!
Eager to implement some extra goodies for Property Binder's next release. Enjoy!
I'm a Principal Consultant at Improving Enterprises in Dallas, TX USA.
Recent Comments