01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: * $Header:$
18: */
19: package org.apache.beehive.netui.compiler.typesystem.impl.env;
20:
21: import org.apache.beehive.netui.compiler.typesystem.env.Messager;
22: import org.apache.beehive.netui.compiler.typesystem.impl.DelegatingImpl;
23: import org.apache.beehive.netui.compiler.typesystem.util.SourcePosition;
24:
25: public class MessagerImpl extends DelegatingImpl implements Messager {
26: protected MessagerImpl(com.sun.mirror.apt.Messager delegate) {
27: super (delegate);
28: }
29:
30: public static Messager get(com.sun.mirror.apt.Messager delegate) {
31: return delegate != null ? new MessagerImpl(delegate) : null;
32: }
33:
34: public void printError(String s) {
35: getDelegate().printError(s);
36: }
37:
38: public void printError(SourcePosition sourcePosition, String s) {
39: if (sourcePosition != null) {
40: assert sourcePosition instanceof SourcePositionImpl : sourcePosition
41: .getClass().getName();
42: getDelegate()
43: .printError(
44: ((SourcePositionImpl) sourcePosition)
45: .getDelegate(), s);
46: } else {
47: getDelegate().printError(s);
48: }
49: }
50:
51: public void printWarning(String s) {
52: getDelegate().printWarning(s);
53: }
54:
55: public void printWarning(SourcePosition sourcePosition, String s) {
56: if (sourcePosition != null) {
57: assert sourcePosition instanceof SourcePositionImpl : sourcePosition
58: .getClass().getName();
59: getDelegate()
60: .printWarning(
61: ((SourcePositionImpl) sourcePosition)
62: .getDelegate(), s);
63: } else {
64: getDelegate().printWarning(s);
65: }
66: }
67:
68: public void printNotice(String s) {
69: getDelegate().printNotice(s);
70: }
71:
72: public void printNotice(SourcePosition sourcePosition, String s) {
73: assert sourcePosition != null;
74: assert sourcePosition instanceof SourcePositionImpl : sourcePosition
75: .getClass().getName();
76: getDelegate().printNotice(
77: ((SourcePositionImpl) sourcePosition).getDelegate(), s);
78: }
79:
80: protected com.sun.mirror.apt.Messager getDelegate() {
81: return (com.sun.mirror.apt.Messager) super.getDelegate();
82: }
83: }
|