KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > env > AccessRestriction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.compiler.env;
12
13 public class AccessRestriction {
14
15     private AccessRule accessRule;
16     private String JavaDoc[] messageTemplates;
17     public AccessRestriction(AccessRule accessRule, String JavaDoc [] messageTemplates) {
18         this.accessRule = accessRule;
19         this.messageTemplates = messageTemplates;
20     }
21     
22     /**
23      * Returns readable description for problem reporting,
24      * message is expected to contain room for restricted type name
25      * e.g. "{0} has restricted access"
26      */

27     public String JavaDoc getMessageTemplate() {
28         return this.messageTemplates[0];
29     }
30     
31     public String JavaDoc getConstructorAccessMessageTemplate() {
32         return this.messageTemplates[1];
33     }
34
35     public String JavaDoc getMethodAccessMessageTemplate() {
36         return this.messageTemplates[2];
37     }
38
39     public String JavaDoc getFieldAccessMessageTemplate() {
40         return this.messageTemplates[3];
41     }
42
43     public int getProblemId() {
44         return this.accessRule.getProblemId();
45     }
46
47     public boolean ignoreIfBetter() {
48         return this.accessRule.ignoreIfBetter();
49     }
50 }
51
Popular Tags