GithubHelp home page GithubHelp logo

isabella232 / bullet-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xmartlabs/bullet

0.0 0.0 0.0 61 KB

Provides Dagger1-like ObjectGraph API around Dagger2 Components

License: Apache License 2.0

Shell 0.55% Java 99.45%

bullet-1's Introduction

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.

bullet-1's People

Contributors

tbroyer avatar bryant1410 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.