All language subtitles for 3. Constructor Injection - Write Some Code - Part 1

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese Download
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 1 00:00:01,617 --> 00:00:02,982 Let's go ahead and move into Eclipse 2 2 00:00:02,982 --> 00:00:03,963 and let's get our hands dirty. 3 3 00:00:03,963 --> 00:00:05,650 Let's write some code. 4 4 00:00:05,650 --> 00:00:07,370 So looking at our to-do list here, 5 5 00:00:07,370 --> 00:00:08,826 or our step-by-step, 6 6 00:00:08,826 --> 00:00:10,295 the first thing we need to do is 7 7 00:00:10,295 --> 00:00:14,128 define the dependency interface and the class. 8 8 00:00:15,070 --> 00:00:19,165 And we'll make use of that same dependency from earlier, 9 9 00:00:19,165 --> 00:00:22,432 fortune service and happy fortune service, 10 10 00:00:22,432 --> 00:00:24,509 but we'll go ahead and cut the code again from scratch 11 11 00:00:24,509 --> 00:00:26,204 just so we're all on track 12 12 00:00:26,204 --> 00:00:28,090 and everything is sinked up. 13 13 00:00:28,090 --> 00:00:29,665 I'll simply do a right click, 14 14 00:00:29,665 --> 00:00:31,582 I'll say new interface. 15 15 00:00:33,700 --> 00:00:38,514 And the name of this interface is FortuneService. 16 16 00:00:38,514 --> 00:00:39,399 Another name there, 17 17 00:00:39,399 --> 00:00:41,126 I keep all the other defaults 18 18 00:00:41,126 --> 00:00:42,543 and I hit finish. 19 19 00:00:45,608 --> 00:00:48,294 So at this point I have a very basic fortune service. 20 20 00:00:48,294 --> 00:00:50,666 There's nothing inside of it. 21 21 00:00:50,666 --> 00:00:53,390 I'm gonna define just one method here, 22 22 00:00:53,390 --> 00:00:55,765 this method will be called 23 23 00:00:55,765 --> 00:00:56,682 getFortune. 24 24 00:00:57,609 --> 00:00:59,529 And open paren, close paren, and a semicolon, 25 25 00:00:59,529 --> 00:01:00,362 and that's it. 26 26 00:01:00,362 --> 00:01:01,374 Somethin' very simple. 27 27 00:01:01,374 --> 00:01:02,597 Not much coding. 28 28 00:01:02,597 --> 00:01:04,559 We like to keep it short 29 29 00:01:04,559 --> 00:01:06,976 and we like to keep it sweet. 30 30 00:01:09,591 --> 00:01:11,720 So there's our fortune service, 31 31 00:01:11,720 --> 00:01:13,935 now what we wanna do is actually create a class 32 32 00:01:13,935 --> 00:01:16,457 that'll actually implement this interface. 33 33 00:01:16,457 --> 00:01:18,687 So I'll move back over here to my package, 34 34 00:01:18,687 --> 00:01:22,270 I'll do a right click, I'll say new, class. 35 35 00:01:26,297 --> 00:01:30,464 Now the name of this class will be HappyFortuneService. 36 36 00:01:31,328 --> 00:01:34,441 So that's the name and then this class 37 37 00:01:34,441 --> 00:01:36,598 will actually implement an interface. 38 38 00:01:36,598 --> 00:01:38,532 So down in the interfaces section, 39 39 00:01:38,532 --> 00:01:41,858 let's click on that button to the right called add. 40 40 00:01:41,858 --> 00:01:44,723 And the name of the interface that we're looking for 41 41 00:01:44,723 --> 00:01:46,706 here is called FortuneService. 42 42 00:01:46,706 --> 00:01:48,221 So I just type in fortune up top, 43 43 00:01:48,221 --> 00:01:50,317 you'll get this FortuneService listing there 44 44 00:01:50,317 --> 00:01:51,725 as a matching item. 45 45 00:01:51,725 --> 00:01:54,549 Then go ahead and hit on the okay button. 46 46 00:01:54,549 --> 00:01:57,029 So our interfaces section should be updated 47 47 00:01:57,029 --> 00:01:58,720 with FortuneService. 48 48 00:01:58,720 --> 00:01:59,796 Looks good. 49 49 00:01:59,796 --> 00:02:01,127 Let's keep all the other defaults 50 50 00:02:01,127 --> 00:02:03,794 and let's hit the finish button. 51 51 00:02:04,689 --> 00:02:05,629 Okay, good. 52 52 00:02:05,629 --> 00:02:06,462 Here we go. 53 53 00:02:06,462 --> 00:02:08,339 So we have our HappyFortuneService implements 54 54 00:02:08,339 --> 00:02:09,245 FortuneService, 55 55 00:02:09,245 --> 00:02:11,118 we're simply gonna give a very basic 56 56 00:02:11,118 --> 00:02:12,696 implementation here. 57 57 00:02:12,696 --> 00:02:15,251 On line seven, I'll simply say return, 58 58 00:02:15,251 --> 00:02:18,501 and I will say today is your lucky day. 59 59 00:02:20,604 --> 00:02:22,127 And I'll add the double quote there 60 60 00:02:22,127 --> 00:02:23,014 and that's it. 61 61 00:02:23,014 --> 00:02:26,327 So that's a basic implementation here of this 62 62 00:02:26,327 --> 00:02:27,994 HappyFortuneService. 63 63 00:02:29,412 --> 00:02:30,318 This looks good. 64 64 00:02:30,318 --> 00:02:31,736 Now the one thing that we're gonna do different 65 65 00:02:31,736 --> 00:02:33,457 that we didn't do earlier in the videos 66 66 00:02:33,457 --> 00:02:36,301 is that we're gonna add this @Component annotation. 67 67 00:02:36,301 --> 00:02:39,384 Remember Spring will scan our package 68 68 00:02:40,236 --> 00:02:42,331 and it'll register all components. 69 69 00:02:42,331 --> 00:02:44,110 So we want this HappyFortuneService 70 70 00:02:44,110 --> 00:02:46,365 to be a component that's registered. 71 71 00:02:46,365 --> 00:02:50,532 That looks good and I think we're in good shape so far. 72 72 00:02:58,072 --> 00:03:00,066 Now the next thing we wanna do is we wanna enhance 73 73 00:03:00,066 --> 00:03:01,512 our coach interface. 74 74 00:03:01,512 --> 00:03:04,223 We actually wanna add a method to the coach interface. 75 75 00:03:04,223 --> 00:03:07,232 Right now the coach can give us daily workouts 76 76 00:03:07,232 --> 00:03:10,184 but we also want the coach to be able to give us 77 77 00:03:10,184 --> 00:03:12,294 our daily fortune. 78 78 00:03:12,294 --> 00:03:13,680 So in coach dot java, 79 79 00:03:13,680 --> 00:03:15,700 I'm gonna add a new method here called 80 80 00:03:15,700 --> 00:03:18,867 GetDailyFortune that returns a string. 81 81 00:03:20,681 --> 00:03:21,514 And that's it. 82 82 00:03:21,514 --> 00:03:24,258 We keep it very simple for right now. 83 83 00:03:24,258 --> 00:03:25,165 Okay, great. 84 84 00:03:25,165 --> 00:03:26,516 This looks good so far. 85 85 00:03:26,516 --> 00:03:27,349 Good job. 6777

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.