delight-factories

Allows definition and management of lightweight factories.

License

License

GPL
GroupId

GroupId

org.javadelight
ArtifactId

ArtifactId

delight-factories
Last Version

Last Version

0.0.3
Release Date

Release Date

Type

Type

bundle
Description

Description

delight-factories
Allows definition and management of lightweight factories.
Project URL

Project URL

https://github.com/javadelight/delight-factories
Source Code Management

Source Code Management

https://github.com/javadelight/delight-factories

Download delight-factories

Dependencies

provided (1)

Group / Artifact Type Version
com.google.gwt : gwt-user jar 2.8.2

test (2)

Group / Artifact Type Version
org.eclipse.xtend : org.eclipse.xtend.lib.gwt jar 2.13.0
junit : junit jar 4.7

Project Modules

There are no modules declared in this project.

Build Status

delight-factories

A simple API for factories based on simple plain Java objects.

Part of Java Delight.

Usage

Create a collection of factories:

FactoryCollection factories = Factories.create();

Define classes for a factory:

private static class MyConfiguration implements Configuration {}
	
private static class MyDependencies implements Dependencies {}

Register a factory:

factories.register(new Factory<String, MyConfiguration, Dependencies>() {

	@Override
	public boolean canInstantiate(Configuration conf) {
		return (conf instanceof MyConfiguration);
	}

	@Override
	public String create(MyConfiguration conf, Dependencies dependencies) {
		
		return "Hello, World!";
	}
	
});

Instantiate an object:

Object created = factories.create(new MyConfiguration(), new MyDependencies());
// created == "Hello, WorlD!";

Maven Dependency

<dependency>
    <groupId>org.javadelight</groupId>
    <artifactId>delight-factories</artifactId>
    <version>[insert latest version]</version>
</dependency>

This artifact is available on Maven Central and BinTray.

Maven Central

Links

-> All Project Reports

Versions

Version
0.0.3