KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > netui > compiler > typesystem > impl > env > MessagerImpl


1 /*
2  * Copyright 2004 The Apache Software Foundation.
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  * $Header:$
17  */

18 package org.apache.beehive.netui.compiler.typesystem.impl.env;
19
20 import org.apache.beehive.netui.compiler.typesystem.env.Messager;
21 import org.apache.beehive.netui.compiler.typesystem.impl.DelegatingImpl;
22 import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
23
24 public class MessagerImpl
25         extends DelegatingImpl
26         implements Messager
27 {
28     protected MessagerImpl( com.sun.mirror.apt.Messager delegate )
29     {
30         super( delegate );
31     }
32     
33     public static Messager get( com.sun.mirror.apt.Messager delegate )
34     {
35         return delegate != null ? new MessagerImpl( delegate ) : null;
36     }
37
38     public void printError( String JavaDoc s )
39     {
40         getDelegate().printError( s );
41     }
42
43     public void printError( SourcePosition sourcePosition, String JavaDoc s )
44     {
45         if ( sourcePosition != null )
46         {
47             assert sourcePosition instanceof SourcePositionImpl : sourcePosition.getClass().getName();
48             getDelegate().printError( ( ( SourcePositionImpl ) sourcePosition ).getDelegate(), s );
49         }
50         else
51         {
52             getDelegate().printError( s );
53         }
54     }
55
56     public void printWarning( String JavaDoc s )
57     {
58         getDelegate().printWarning( s );
59     }
60
61     public void printWarning( SourcePosition sourcePosition, String JavaDoc s )
62     {
63         if ( sourcePosition != null )
64         {
65             assert sourcePosition instanceof SourcePositionImpl : sourcePosition.getClass().getName();
66             getDelegate().printWarning( ( ( SourcePositionImpl ) sourcePosition ).getDelegate(), s );
67         }
68         else
69         {
70             getDelegate().printWarning( s );
71         }
72     }
73
74     public void printNotice( String JavaDoc s )
75     {
76         getDelegate().printNotice( s );
77     }
78
79     public void printNotice( SourcePosition sourcePosition, String JavaDoc s )
80     {
81         assert sourcePosition != null;
82         assert sourcePosition instanceof SourcePositionImpl : sourcePosition.getClass().getName();
83         getDelegate().printNotice( ( ( SourcePositionImpl ) sourcePosition ).getDelegate(), s );
84     }
85
86     protected com.sun.mirror.apt.Messager getDelegate()
87     {
88         return ( com.sun.mirror.apt.Messager ) super.getDelegate();
89     }
90 }
91
Popular Tags