KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > j2biz > pencil > test > stuff > TestCastingCallerClass


1 /*
2  * Copyright 2004 Andreas Siebert (j2biz community)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7
8  * http://www.apache.org/licenses/LICENSE-2.0
9
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package com.j2biz.pencil.test.stuff;
17
18 import com.j2biz.log.LOG;
19
20
21 public class TestCastingCallerClass {
22
23        
24     final public TestCascadeInstance1 testVar = new TestCascadeInstance1();
25     
26     public TestCastingCallerClass() {
27          
28         LOG.debug( "this.interface.public.instance = ${testVar.field1}" );
29         LOG.debug( "this.interface.default.instance = ${testVar.field2}" );
30         LOG.debug( "this.class.public.instance = ${testVar.field3}");
31         LOG.debug( "this.class.default.instance = ${testVar.field4}" );
32         
33         // >>> Direktes Cascading:
34
LOG.debug( "parent.interface.public.instance = ${(com.j2biz.pencil.test.stuff.TestCastingInstance3):testVar.field1}" );
35         LOG.debug( "parent.class.public.instance = ${(com.j2biz.pencil.test.stuff.TestCastingInstance2):testVar.field3}" );
36         
37         // statische Variablen werden eigentlich ueber direct-caller abgeholt.. sollte diese Variante dennoch funktionieren ?
38
// new StringBuffer ().append( ((com.j2biz.pencil.test.stuff.TestCastingInstance3) testVar).field1 );
39

40          // direct in der casting-klasse nachshauen..
41
// voraussetzung die casting-klasse ist in der vererbungshierarchie der aktuellen klasse vorhnaden
42
// new StringBuffer ().append( ((TestCastingInstance2) testVar).field3 );
43
}
44 }
45
Popular Tags