Hire everyone in this story are you going to go ahead and we're going to create another method in order
to return all the modular objects that you have inside a school like database.
So excited state of his handler class I-30 and include the brace of this method modify emotional object
here and before the ending really break out of this class database handler I'm going to create another
method so just type in here public.
Now we need to specify the return type of this method which is going to be released are released and
then inside the angle brackets we need to specify the actually type of objects that are going to be
inside this are a list which is going to be martial art.
And then we need to specify the name of this method which is going to be returned.
All martial art objects all martial art objects.
And here we just need to put a pair of prentices.
So let's open and closed this method by using these curly braces.
So first of all we need to get them a skill like database.
So just I think he had a skill like database database assignment operator gets right Hebel database
semicolon and then we need to specify the SDL comment.
So I can just say streams and just type in here as well query as well query come on because we want
to get all the objects from our light database.
We use query here and then we put an assignment operator here and I just put two codes here and I can
say select start with or start here shift.
And number 8 just hold down the shift key on your keyboard and then press on about 8 on your keyboard.
And then I can say from space and I put up a A-plus operator here and I just need to refer to the motion
or table martial arts table a semicolon.
So it's going to actually select all the objects that are inside of the marshal or table.
Right.
So this is this will come at quite a comment here.
Now I can say in order to process this as you l.com quite calm and meaning to have an object of type
cursor.
So just open your cursor and its name is going to be cursor assignment operator.
It can refer to this database so database thought.
Rob Querrey so it look at the Smurfette here raw query the return type of this method is actually the
type cursor right.
So this method is going to return a value of type cursor.
So let's select this method here this one.
And then press on until your keyboard blockwork.
So look at this move it here.
There are two versions of this method.
Let me show you this mirror again.
So there are two the two versions of this for the first version is going to accept only two arguments.
The first argument is that as usual a query comment which we haven't yet in line number one hundred
and eleven.
The second actually the argument is the selection arcs which we are not going to use it in this application
in this method.
And look at the second version of this method.
We have also another argument here.
The first argument is it is cancellation signal.
Again we are not going to use these arguments here.
It's not necessary for the application.
So if you are going to use the first version of this if it is just going to accept as a school query
comment and the selection box.
So just for the actual quoted comment just passed this value as well.
Come on.
Come on come on.
And for the second argument just part of I'll pass the value not because we want to access all the objects
inside our school database right.
We do not want to actually pass or value for the selection arcs here.
So if we pass the value null.
OK.
After this line of code I can say this that the return type of this method is actually really straight.
So this movement must return a value of they are.
So let's create that here let's create a variable of that at least it is and inside the angle brackets
specify the type of the objects that are going to be inside these are at least martial arts and the
name of this list is going to be martial arts.
OK.
And then put an assignment operator here new Aurelie semicolon.
That's it.
Now we have actually an array list that are going to accept objects of type martial arts.
Now after this line of code let's create a loop actually avoid loops.
So just step in here voyde let's I told you that this cursor object is needed in order to process this
as well query comment.
Right.
So say cursor dot move to next move to next if this cursor which is actually responsible for processing
this is Ul-Qadri comment.
If it can go to the mall and to the next object inside the school like database.
Right.
Because we want to use this cursor in order to get those objects inside our database.
If this occurs object can move to the next object inside our database.
If there is actually another object inside our database then in that case we are going to go inside
the loop here and we can say let's create a variable of type martial arts here martial art and the name
of this variable is going to be current martial art object current martial art object assignment operator
new martial art.
OK.
But because we created a custom constructor inside the martial art class we must actually pass values
for that constructor.
So look at these arguments here.
First we need to pass the ID and then we need to pass the name the price the color.
Right.
So look at this actually price argument here it is an integer but we forgot to change the data type
of this argument inside our martial art class so let's go to the martial art class.
And here you can see that this constructor here accepts an argument of the type integer right.
Its name is price.
So if changed the data type of this price here to double.
So let's change it here to double.
Now let's go to the database handler class and here for this second let me actually write it again.
Martial art now is going to say that we must pass a value of type I should be of type double for the
price.
Look at this value here.
Double price right.
Because we changed the data type of this argument inside our martial art class for that constructor.
So first we need to pass the ID right.
But again it's the job of the cursor to process that those values.
So we need to say cursor is going to get a value of type.
And then we must convert that value to a value of integer.
So we need to say integer that parse and inside Apprentice's.
I'm going to refer to this cursor object cursor that get strange and that we need to pass the column
index.
So the ID is in the column index number 0.
So I'm going to pass the value 0 here.
Right.
That's it.
So here let me actually create a new line here for these arguments that we're are going to pass.
So the first argument is for the ID right.
And now we need to specify the second argument which is going to be the name.
And it is of extreme right.
So just put a comma here.
This is our first argument right now.
I put a comma here and for the second argument again cursor that get screened.
So the name is actually of type string right there.
Martial arts name.
So here I just need to pass the column index the column index is going to be Vaun right Dimanche that
name is in the Clinton-Dix number one.
Just with a comma here and then create a new line.
So now we need to specify the emotional price.
So again cursor.
So notice that the modular price is of type double.
OK.
So cursive does get double on the column index is going to be column in this number to right comma.
And finally we have to marshal that color.
So again cursor does get strange.
And so the apprentice's 8:22 column index which is going to be called this number three.
So notice that first we have the ID here and then we have the name which is in the calumniate number
one.
We have the price column of this number two and we have the color which is in the color coloring columnist's
number free.
So now that we have this martial art object is cut into much of the object.
Here we can add this object to our martial arts Aurelia's.
So I can say martial arts which is stuff that I really start at current martial art object semicolon.
That's it.
So after this while loop here first we must close the database.
So they tell me is that close.
And finally we need to return this.
Martial arts are elites so martial arts semicolon.
So in this way the Smurfette return almost for objects is going to return all the martial art objects
that are actually inside the database.
So this is the job of this.
Now we need to create another team effort.
So after the end in Kerley process of the Smurfette return all objects I'm going to create another Merfeld
here.
So we're going to create that Meffert in the next tutorial.
Thank you very much for watching and I'll see you in the next story.