propane 0.1.0-SNAPSHOT API
Propane
Propane is a library designed to ease the development of libraries by featuring scope based access to the components.
You can think of propane like a manual dependency injection framework without all the 'magic'. At it's core it's actually nothing more than a mapping of properties and values, accessible by a scope based api.
Propanes primary goal is to be used inside libraries. It should not replace a dependency injection framework nor should it be a general application configuration framework.
Properties
A Property is an identifier for a certain component of a library.
It holds information about the type of property, the java class represented by this component, the scope of a property
and more.
A library component could be some setting (configured via a builder), a service used by the library internals or
a user provided implementation of an interface for example. It actually just a piece of information, that the library needs
for its functionality.
The value of a property is provided by property providers.
Property Provider
The value of a property is provided by one or more PropertyProviderSkeleton.
They are called lazily when a properties value is requested. The value is then cached and reused.
Introspection
The IntrospectionSkeleton and IntrospectionImplSkeleton classes are the main entry points
of this framework at runtime. They allow access to property values and the event bus.
Additionally, these classes shape the scoped based character of propane. Each IntrospectionSkeleton
is bound to a specific scope, thus restricting access to certain properties.
Scopes
Commonly a library is structured in certain scopes. Each Scope represents a stage in the libraries lifetime (runtime).
Scopes life in a hierarchy, where a scope inherits all properties of its parents.
For example, a library can consist of 3 stages/scopes:
- CONFIGURATION → the library is fully configured
- INITIALIZED → the library is fully initialized/the framework is started
- REQUEST → the library got a user request and is computing it
If you are in scope INITIALIZED, you can access all properties of CONFIGURATION too.
If you are in scope REQUEST, you can access all properties of CONFIGURATION and INITIALIZED too.
Skeleton Classes
Many classes/interfaces of this library aren't intended to be directly used by users of this library in most cases.
Propane will generate specific implementations of these classes/interfaces at compile time using an annotation processor. Such specific implementations are generated for each specification and are much simpler (in terms of generics and used types) than the "skeleton classes".
Such skeleton classes are marked by @Skeleton and include, for example,
IntrospectionSkeleton and IntrospectionImplSkeleton. Please note,
that the absence of @Skeleton just indicates, that all methods can be used without
throwing SkeletonMethodException not that there isn't a better suited specific implementation
generated by Propane.