Skip to content

Instantly share code, notes, and snippets.

View Hwiggy's full-sized avatar

Hunter Wignall Hwiggy

  • USA, New York
View GitHub Profile
@Hwiggy
Hwiggy / Dependency.java
Created September 30, 2020 20:29
[Java] Dependency Injection
/**
* Dependency class for the Dependency Injection example.
*/
class Dependency {
/**
* The value enclosed inside this Dependency
*/
private final Object value;
/**
@Hwiggy
Hwiggy / Example.java
Created August 8, 2018 09:01
How to do dependency injection
//This Dependency class will be our main class.
public class Dependency implements Dependable{
//Create a Dependent object using the instance of this dependency in the constructor
private final Dependent dependent = new Dependent(this);
//Create an OtherDependent object using the instance of this dependency in the constructor
private final OtherDependent otherDependent = new OtherDependent(this);
//Create an OtherDependent object using the instance of the dependent object in the constructor

Keybase proof

I hereby claim:

  • I am hwiggy on github.
  • I am hwiggy (https://keybase.io/hwiggy) on keybase.
  • I have a public key ASA0R0k6oMEb8muQt3BTm2c6niJ1VrQLMn4Ww5SJqTuDjQo

To claim this, I am signing this object: