From fdbd3c06a13f14927f372ccdc9609096a89a1681 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Tue, 9 Feb 2016 21:06:07 +0100 Subject: [PATCH] Make all autowired members in examples and the tutorial private To set a proper example! --- TUTORIAL.md | 8 ++++---- example/annotations/app.d | 4 ++-- example/applicationcontext/app.d | 4 ++-- example/arraycompletion/app.d | 2 +- example/qualifiers/app.d | 4 ++-- example/quickstart/app.d | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/TUTORIAL.md b/TUTORIAL.md index 916a82b..867d296 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -111,7 +111,7 @@ If you want to autowire a type registered to multiple concrete types, specify a ```d class BluePaint { @Autowire!Blue - public Color color; + private Color color; } ``` If you registered multiple concrete types to the same supertype and you do not resolve using a qualifier, a ResolveException is thrown stating that there are multiple candidates for the type to be resolved. @@ -124,7 +124,7 @@ If you have registered multiple concrete types to a super type, you can autowire class ColorMixer { @Autowire - public Color[] colors; + private Color[] colors; } dependencies.register!(Color, Blue); @@ -171,10 +171,10 @@ This means that after the registration of an application context some dependenci class Context : ApplicationContext { @Autowire - public SomeClass someClass; + private SomeClass someClass; @Autowire - public SomeOtherClass someOtherClass; + private SomeOtherClass someOtherClass; public override void registerDependencies(shared(DependencyContainer) container) { container.register!SomeClass; diff --git a/example/annotations/app.d b/example/annotations/app.d index aaac6fb..804d6fe 100644 --- a/example/annotations/app.d +++ b/example/annotations/app.d @@ -27,11 +27,11 @@ class SuperSecurityDevice { class SecurityManager { @Autowire - public SuperSecurityDevice levelOneSecurity; + private SuperSecurityDevice levelOneSecurity; @Autowire @AssignNewInstance - public SuperSecurityDevice levelTwoSecurity; + private SuperSecurityDevice levelTwoSecurity; } void main() { diff --git a/example/applicationcontext/app.d b/example/applicationcontext/app.d index a7c4575..71b0384 100644 --- a/example/applicationcontext/app.d +++ b/example/applicationcontext/app.d @@ -12,7 +12,7 @@ import std.stdio; class TownSquare { @Autowire - public MarketStall marketStall; + private MarketStall marketStall; public void makeSound() { marketStall.announceGoodsForSale(); @@ -45,7 +45,7 @@ class MarketStall { class ExampleApplicationContext : ApplicationContext { @Autowire - public Goods goods; + private Goods goods; public override void registerDependencies(shared(DependencyContainer) container) { container.register!(Goods, Fish); diff --git a/example/arraycompletion/app.d b/example/arraycompletion/app.d index 93fed84..bdcd47e 100644 --- a/example/arraycompletion/app.d +++ b/example/arraycompletion/app.d @@ -33,7 +33,7 @@ class CardboardBoxPie : Pie { class PieEater { @Autowire - public Pie[] pies; + private Pie[] pies; public void eatThemAll() { foreach(pie ; pies) { diff --git a/example/qualifiers/app.d b/example/qualifiers/app.d index bc07ea3..9edd370 100644 --- a/example/qualifiers/app.d +++ b/example/qualifiers/app.d @@ -29,10 +29,10 @@ class HybridCar { alias KilometersPerHour = int; @Autowire!FuelEngine - public Engine fuelEngine; + private Engine fuelEngine; @Autowire!ElectricEngine - public Engine electricEngine; + private Engine electricEngine; public void moveAtSpeed(KilometersPerHour speed) { if (speed <= 45) { diff --git a/example/quickstart/app.d b/example/quickstart/app.d index 965c68f..8d2ac87 100644 --- a/example/quickstart/app.d +++ b/example/quickstart/app.d @@ -12,7 +12,7 @@ class RelationalDatabase : Database {} class DataWriter { @Autowire - public Database database; // Automatically injected when class is resolved + private Database database; // Automatically injected when class is resolved } void main() {