Promote your software
There is a set utility classes in Gaia library. They are implemented in eu.beesoft.gaia.util package:
This class was developed to replace java.beans.PropertyChangeSupport class functionality. If you use it as parent class for your beans
Language and LanguageListener
Encapsulates the work with resource bundles and language dependent texts. LanguageListener is the listener interface to receive language changed events.
Miner is a class dedicated to support the data binding. From external perspective it has two simple methods:
Property name can be a simple property name, or you can use the dot-convention to chain objects referenced from properties. For example, if object A has property a that references object B, and object B has property b that references object C, and object C has property c you want to get, you can use as property name text a.b.c to get / set this property.
Miner prioritizes a method access (via getters / setters), but if the method for the property cannot be found, it uses the field access.
You can use this class "as is". But you have to subclass it if
ObjectBuilder and ObjectBuilderFactory
This factory is designed to reading a XML stream of descriptors and to create an appropriate ObjectBuilder instance for each parsed element. Then it manages initializing of builders and creating and initializing objects in builders. There is one or collection of objects created and initialized at the end of this process.
This implementation is abstract enough to let you free to design the form of XML (tags for elements, attributes, ...) and to program your own ObjectBuilder implementations. There is one implementation for building Swing components from XML file in package eu.beesoft.gaia.swing.builder.
Regardless of the high abstract level of the basic implementation, there are a few XML element attributes supported by ObjectBuilderFactory and ObjectBuilder:
ObjectBuilder class is an abstract superclass of all builders. A builder serves as a factory for the creation and initialization of the created object. The building process is managed by ObjectBuilderFactory. This implementation does not dictate relationships between builder, created object and XML element - it is your responsibility.
Each builder is managed by ObjectBuilderFactory instance that created it. ObjectBuilderFactory loads a XML description and for each element creates a new appropriate builder. This is done in these steps:
When ObjectBuilderFactory processed all XML elements and for each executed steps described above, it walks each builder again and invokes method initObjectProperties() on it. Builder for each property invokes method initObjectProperty(String, String). This method in current implementation searches for initialization method for given property and invokes it.
When all builders were requested to initiaze their properties, the ObjectBuilderFactory notifies each builder about its hierarchy position. On each builder with children is invoked method addChild(ObjectBuilder). This is done from bottom to top in the builder hierarchy, so parent is notified about its children when each its child was notified about its children.
After that is builder and its object fully initialized and object can be used in application.
Utility class for Java reflection. Implements a set of the methods to get field or method from the class (and its superclasses), get or set value to a field, invoke methods, etc.
Utility class for the stream I/O operations. Returns an input stream or reader for given name, it is looking for it in classpath or in filesystem, closes streams.
Exceptions are wrapped by RuntimException, so there is no need for try-catch blocks in your code.
This is an example to copy file with this class:
InputStream is = Streams.getInputStream ("..."); // resource name OutputStream os = Streams.getOutputStream ("..."); // target file name Streams.copy (is, os); Streams.close(os); Streams.close(is);
General value object that holds its values as properties in the internal map. This object has no getters / setters for individual properties, there is one getProperty(String)} method and one setProperty(String, Object)} method. The setProperty() method generates property change event (in parent class AbstractBean).
It encapsulates functionality of the java.lang.Process, java.lang.ProcessBuilder and some methods from java.lang.Runtime classes. It supports to:
There is also a set of the static
This implementation solves the problem of the Process.waitFor() method, which hangs when are not read the process streams.