01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.env;
11:
12: public class AccessRestriction {
13:
14: private AccessRule accessRule;
15: private String[] messageTemplates;
16:
17: public AccessRestriction(AccessRule accessRule,
18: String[] messageTemplates) {
19: this .accessRule = accessRule;
20: this .messageTemplates = messageTemplates;
21: }
22:
23: /**
24: * Returns readable description for problem reporting,
25: * message is expected to contain room for restricted type name
26: * e.g. "{0} has restricted access"
27: */
28: public String getMessageTemplate() {
29: return this .messageTemplates[0];
30: }
31:
32: public String getConstructorAccessMessageTemplate() {
33: return this .messageTemplates[1];
34: }
35:
36: public String getMethodAccessMessageTemplate() {
37: return this .messageTemplates[2];
38: }
39:
40: public String getFieldAccessMessageTemplate() {
41: return this .messageTemplates[3];
42: }
43:
44: public int getProblemId() {
45: return this .accessRule.getProblemId();
46: }
47:
48: public boolean ignoreIfBetter() {
49: return this.accessRule.ignoreIfBetter();
50: }
51: }
|