OOP2

Added reflection class, which is not finished at all.

Author
Maarten Vangeneugden
Date
Nov. 13, 2015, 12:56 p.m.
Hash
9ff17e25922239d1c0564ae95cca3555027942f8
Parent
ec784ef46729d6aa39254d243bd10d18625e1fad
Modified files
07/Reflection.java
07/opdrachten.txt

07/Reflection.java

20 additions and 0 deletions.

View changes Hide changes
+
1
 Copyright 2015 Maarten Vangeneugden
+
2
+
3
	Licensed under the Apache License, Version 2.0 (the "License");
+
4
	you may not use this file except in compliance with the License.
+
5
	You may obtain a copy of the License at
+
6
+
7
	https://www.apache.org/licenses/LICENSE-2.0
+
8
+
9
	Unless required by applicable law or agreed to in writing, software
+
10
	distributed under the License is distributed on an "AS IS" BASIS,
+
11
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
12
	See the License for the specific language governing permissions and
+
13
	limitations under the License.*/
+
14
/**
+
15
 * Reflection - Class that allows the user to pass a class name via the command line, after which a list of its public members and methods is shown.
+
16
 * @author Maarten Vangeneugden - 1438256
+
17
 */
+
18
class Reflection {
+
19
+
20

07/opdrachten.txt

6 additions and 0 deletions.

View changes Hide changes
+
1
Deze literal wordt toegepast op een class (of een class instance). Het geeft een type terug, dat gelijk staat aan een type Class.
+
2
Bijvoorbeeld: String.class returned als type Class<String>.
+
3
+
4
Hoe kan je "instanceof" gebruiken om mogelijke typecasting eerst te controleren?
+
5
"instanceof" is een keyword dat een boolean waarde teruggeeft, die true is als de gegeven instance van het gegeven classtype is. Dit geeft ook true als de class van de gegeven instance een subclass is van de gegeven class. Op die manier is het mogelijk op voorhand de vereiste typecasting te implementeren en zo ook de methods van diezelfde instance te gebruiken.
+
6