KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > j2biz > pencil > test > scenario > refCall > LocalClassTest


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.scenario.refCall;
17
18
19 import com.j2biz.log.LOG;
20 import com.j2biz.pencil.test.additional.DotCallTestObject;
21
22 public class LocalClassTest {
23
24     
25     public int publicField = new Integer JavaDoc(1).intValue();
26     protected int protectedField = new Integer JavaDoc(2).intValue();
27     private int privateField = new Integer JavaDoc(3).intValue();
28     
29     public static class NestedClass {
30         public int publicField = new Integer JavaDoc(1).intValue();
31         protected int protectedField = new Integer JavaDoc(2).intValue();
32         private int privateField = new Integer JavaDoc(3).intValue();
33     }
34     
35     public static void main(String JavaDoc[] args) {
36         class RefData {
37             public int publicField = new Integer JavaDoc(1).intValue();
38             protected int protectedField = new Integer JavaDoc(2).intValue();
39             private int privateField = new Integer JavaDoc(3).intValue();
40             
41             public void testEnclosingClass() {
42                 LocalClassTest encClass = new LocalClassTest();
43                 LOG.debug("refCall.LocalClassTest.refData.testEnclosingClass().public = ${encClass.publicField}");
44                 LOG.debug("refCall.LocalClassTest.refData.testEnclosingClass().protected = ${encClass.protectedField}");
45                 LOG.debug("refCall.LocalClassTest.refData.testEnclosingClass().private = ${encClass.privateField}");
46             }
47         }
48         
49         RefData refData = new RefData();
50
51         LOG.debug("refCall.LocalClassTest.main().public = ${refData.publicField}");
52         
53
54         LOG.debug("refCall.LocalClassTest.main().protected = ${refData.protectedField}");
55         LOG.debug("refCall.LocalClassTest.main().private = ${refData.privateField}");
56         
57         class LocalExtendsNestedClass extends NestedClass {
58             ;
59         }
60         
61         LocalExtendsNestedClass localExtNested = new LocalExtendsNestedClass();
62         
63         LOG.debug("refCall.LocalClassTest.main().LocalExtendsNestedClass.public = ${localExtNested.publicField}");
64         LOG.debug("refCall.LocalClassTest.main().LocalExtendsNestedClass.protected = ${localExtNested.protectedField}");
65         LOG.debug("refCall.LocalClassTest.main().LocalExtendsNestedClass.private = ${localExtNested.privateField}");
66         
67         DotCallTestObject subClass = DotCallTestObject.createSublCass();
68         LOG.debug("refCall.LocalClassTest.main().subClassIsHidden.public = ${subClass.field1}");
69         LOG.debug("refCall.LocalClassTest.main().subClassIsHidden.protected = ${subClass.field2}");
70         LOG.debug("refCall.LocalClassTest.main().subClassIsHidden.private = ${subClass.field3}");
71     }
72     
73 }
74
Popular Tags