Bullet (Parent)

Provides Dagger1-like ObjectGraph API around Dagger2 Components

License

License

Categories

Categories

Net Dagger Application Layer Libs Dependency Injection
GroupId

GroupId

net.ltgt.dagger
ArtifactId

ArtifactId

bullet-parent
Last Version

Last Version

0.20
Release Date

Release Date

Type

Type

pom
Description

Description

Bullet (Parent)
Provides Dagger1-like ObjectGraph API around Dagger2 Components
Project URL

Project URL

https://github.com/tbroyer/bullet
Source Code Management

Source Code Management

https://github.com/tbroyer/bullet

Download bullet-parent

Filename Size
bullet-parent-0.20.pom 4 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/net.ltgt.dagger/bullet-parent/ -->
<dependency>
    <groupId>net.ltgt.dagger</groupId>
    <artifactId>bullet-parent</artifactId>
    <version>0.20</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/net.ltgt.dagger/bullet-parent/
implementation 'net.ltgt.dagger:bullet-parent:0.20'
// https://jarcasting.com/artifacts/net.ltgt.dagger/bullet-parent/
implementation ("net.ltgt.dagger:bullet-parent:0.20")
'net.ltgt.dagger:bullet-parent:pom:0.20'
<dependency org="net.ltgt.dagger" name="bullet-parent" rev="0.20">
  <artifact name="bullet-parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='net.ltgt.dagger', module='bullet-parent', version='0.20')
)
libraryDependencies += "net.ltgt.dagger" % "bullet-parent" % "0.20"
[net.ltgt.dagger/bullet-parent "0.20"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • core
  • compiler
  • integTests

Bullet

Provides Dagger†-like ObjectGraph API around Dagger‡ Components

Download

Releases are deployed to the Central Repository

Snapshots of the development version are available in Sonatype's snapshots repository.

When to use Bullet•

If you don't have a use-case for Bullet•, don't use it. If you do have a use-case for it, try to refactor your code to remove that need. Bullet• can possibly be useful when migrating from Dagger† to Dagger‡, but not everyone agrees.

Usage

Bullet• generates a class with a Bullet prefix next to your components (and next to the Dagger_-prefixed class that Dagger‡ generates), whose constructor expects an instance of your component as argument, and which implements the bullet.ObjectGraph interface providing:

  • a <T> T get(Class<T> type) method to get an instance of some type T
  • a <T> T inject(T instance) method to inject members of some existing instance of type T

The ObjectGraph will delegate to the appropriate method of the wrapped component depending on the argument and, similarly to Dagger†, throw an IllegalArgumentException if none can be found.

Bullet• is triggered by Dagger‡'s @Component and @Subcomponent annotations, so you only need to put Bullet• in your processor path to get it to work; no need to change anything to your component interfaces.

Notes on name and version

Dagger's name comes from a play on words because it builds a directed acyclic graph (DAG). It happens that Unicode has a character named dagger (†): codepoint U+2020. Dagger 2 is sometimes shortened to ‡, the double-dagger Unicode character, codepoint U+2021. Bullet is thus named after Unicode's U+2022.

Because I started this project only as a proof-of-concept and mostly for fun, and to learn more about annotation processors, I'll name versions after firearms calibers (not that I like guns or find them “fun” –I don't– but just to continue on the pun), possibly ending with a 1.0 silver bullet.

License

Copyright 2014 Thomas Broyer

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Versions

Version
0.20
0.1