Base Classes Library

The Base Classes Library provide several useful classes and utilities that are used in other projects. Of course, the library can be used in external projects as well, as it is published under the GNU Lesser General Public License 3.0.

Maven Coordinates

The last version published is 1.2.9. Release Notes can be viewed here.

   <dependency>
      <groupid>eu.ralph-schuster</groupid>
      <artifactid>baselib</artifactid>
      <version>1.2.9</version>
   </dependency>

Download

You can download the library from maven.org. The latest stable version is 1.2.9. Sources are available through maven.org or can be browsed in SVN.

Documentation

Previous Releases

Eclipse/Luna Plugin

This module is part of the Eclipse RCP Common Feature.

Bugs and Change Requests

A Jira instance is setup for you to report bugs and request changes. All you need to do is register and create a new issue for the project and respective module (called Component in Jira).

Available Packages and Classes

The following sections briefly describe the packages and classes available. You should consult the Java API Documentation and the source code for a better understanding.

rsbaselib.bean.IBean

An interface to formally mark Java Bean behaviour. The interface defines the methods that all beans need to implement.

rsbaselib.bean.AbstractBean

Basic implementation of Java Bean behaviour. The class provides the bean infrastructure required to properly behave like a Java Bean.

rs.baselib.configuration.IConfigurable

An interface marking an object as being able to configure itself from a Configuration object. ConfigurationUtils provides methods that can instantiate and setup such self-configurable objects.

Package rs.baselib.crypto

The package provides a complete framework that allows crypting and decrypting strings or streams as well as signing them. Most important classes are Encrypter, Decrypter, DataSigner and EncryptionUtils. Latter also provides a fast method to generate random strings such as passwords or salts.

rs.baselib.io.ConverterUtils

Various static methods to convert Java objects to their byte presentation and vice versa. These methods can be used to send Java objects over streams or into files with a ASCII-safe encoding, e.g. as BASE64 encoded strings (see also EncryptionUtils).

rs.baselib.io.FileFinder

Most-likely one of the most useful classes of all. It will find a file on disk based on it’s name. It tries to access the file directly from disk or via a ClassLoader (search in classpath). As long as you are sure that a file in available via your classpath, this class will find it.

rs.baselib.lang.LangUtils

The class provides methods to find the specific signature of a generic class at runtime as well as methods to null-safe convert simple Java type objects (int, long, float, etc) from objects representing these objects (e.g. strings). The getBoolean() method has many more option for TRUE/FALSE than the standard Boolean Java class.

rs.baselib.lang.ResourceList

This class provides methods to handle tasks around files that are available in JAR files. There are methods providing you the Manifest files as well as complete lists of files for each JAR available.

Package rsbaselib.security

This package defines the IPasswordCallback interface which can be used whenever your application requires a password. It probably can be better implemented through the JAAS means. However, for simple password requests, this interface is quite useful. The DefaultPasswordCallback will take a password from a configuration file.

Package rs.baselib.test

This package provide a new annotation @IgnoreTest that can be used to further control your own unit tests. The annotation can hold a list of string (which you actually define yourself) that define what specific tests shall be ignored. Your unit tests can later verify the annotation to decide whether to test a specific element or not. This is useful when you want to e.g. test all setters of your objects but some classes define additional setters that need to be excluded from this kind of test.

rs.baselib.util.BeanComparator

Null-safe version of the Apache Commons Beans class. It compares objects null-safe by using a specific property of a bean.

rsbaselib.util.DefaultComparator

DefaultComparator has a static instance variable that can be used when your comparison tasks are simple ones. The comparator will use the best available comparison method (Comparable, IDisplayable – see below, IDisplayProvider – see below, toString presentation).

rs.baselib.util.CommonUtils

Some minor methods including a correct version string comparison.

rs.baselib.util.IDisplayable

Defines an interface that allows objects to return different strings for different languages which shall be used for display to a front-end user.

rs.baselib.util.IDisplayProvider

Similar interface as IDisplayable but allows objects to return a single string only which shall be used for display to a front-end user.

rs.baselib.util.ReleaseRepository

Provides an infrastructure to store JAR package information in a properties file within the JAR and collect them later at runtime. All my Maven projects provide these properties files so that the version of all packages can be retrieved from the ReleaseRepository at runtime.

rs.baselib.util.RsDate

A replacement for the standard java.util.Date which is basically a Calendar instance. Using this class will ease computation with dates and calendars. RsDay, RsMonth and RsYear are classes based on RsDate but will represent days, months or years only. A DateTimePeriod class completes the date classes.

rs.baselib.util.IWrapper

Simple interface for a wrapper class which allows retrieving the wrapped object if required.

3 Responses to “Base Classes Library”

  1. Ralph’s TechBlog » Blog Archive » RS Library 1.0.0 released Says:

    […] baselib module […]

  2. Ralph’s TechBlog » Blog Archive » The Class.forName() problem Says:

    […] added the helper methods in my RS Base Classes Library class LangUtils where you can use it directly from (V1.2.2 – available very soon) in your […]

  3. Ralph’s TechBlog » Blog Archive » Eclipse RCP Common Feature launched Says:

    […] RS Library Base Classes […]

Leave a Reply