|
Project Information
Featured
Downloads
Links
|
What?The WizTools.org Commons Library (part of WizTools.org project) is a rich collection of commonly used convenience classes and data-structures for Java. This is developed and maintained by Subhash Chandran. Dependency<dependency> <groupId>org.wiztools.commons</groupId> <artifactId>wiztools-commons-lib</artifactId> <version>0.3.0</version> </dependency> This library does not depend on any external libraries. ExamplesNote: The examples are for bringing to your attention the features of this library. It is a small sample of the rich content in this library. All classes are from the package: import org.wiztools.commons.*; Content of FileFile f = ...; FileUtil.getContentAsString(f, Charsets.UTF_8); Non-RE based split()String splitStr = ...; String input = ...; List<String> arr = StringUtil.explode(splitStr, input); Encode XML/HTML special charactersString encoded = XmlEntityEncode.encode(input); Java equivalent of PHP md5() functionString input = ...;
String hash = DigestUtil.md5hex(input.getBytes("UTF-8"));Map data-structure holding multiple valuesMultiValueMap<String, String> m = new MultiValueMapArrayList<String, String>();
m.put("key1", "value1");
m.put("key1", "value2");
// Returns "value1" and "value2":
Collection<String, String> values = m.get("key1");MultiValueMap.java MultiValueMapArrayList.java Service Locator To Load Implementation// The relationship between MyInterface and MyInterfaceImplClass // needs to be defined in the properties file // wiztools-service-locator.properties and should be available in // the classpath. The association is defined thus: // com.package.MyInterface = com.package.MyInterfaceImplClass MyInterface obj = Implementation.of(MyInterface.class); |