当前位置: 首页>>代码示例>>Java>>正文


Java AccessRule类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.env.AccessRule的典型用法代码示例。如果您正苦于以下问题:Java AccessRule类的具体用法?Java AccessRule怎么用?Java AccessRule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AccessRule类属于org.eclipse.jdt.internal.compiler.env包,在下文中一共展示了AccessRule类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encodeAccessRule

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
private void encodeAccessRule(
    AccessRule accessRule, XMLWriter writer, boolean indent, boolean newLine) {

  HashMap parameters = new HashMap();
  parameters.put(TAG_PATTERN, new String(accessRule.pattern));

  switch (accessRule.getProblemId()) {
    case IProblem.ForbiddenReference:
      parameters.put(TAG_KIND, TAG_NON_ACCESSIBLE);
      break;
    case IProblem.DiscouragedReference:
      parameters.put(TAG_KIND, TAG_DISCOURAGED);
      break;
    default:
      parameters.put(TAG_KIND, TAG_ACCESSIBLE);
      break;
  }
  if (accessRule.ignoreIfBetter()) parameters.put(TAG_IGNORE_IF_BETTER, "true"); // $NON-NLS-1$

  writer.printTag(TAG_ACCESS_RULE, parameters, indent, newLine, true);
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:ClasspathEntry.java

示例2: writeRestriction

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
private void writeRestriction(AccessRuleSet accessRuleSet, DataOutputStream out) throws IOException {
	if (accessRuleSet == null) {
		out.writeInt(0);
	} else {
		AccessRule[] accessRules = accessRuleSet.getAccessRules();
		int length = accessRules.length;
		out.writeInt(length);
		if (length != 0) {
			for (int i = 0; i < length; i++) {
				AccessRule accessRule = accessRules[i];
				writeName(accessRule.pattern, out);
				out.writeInt(accessRule.problemId);
			}
			out.writeByte(accessRuleSet.classpathEntryType);
			out.writeUTF(accessRuleSet.classpathEntryName);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:State.java

示例3: encodeAccessRule

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
private void encodeAccessRule(AccessRule accessRule, XMLWriter writer, boolean indent, boolean newLine) {

		HashMap parameters = new HashMap();
		parameters.put(TAG_PATTERN, new String(accessRule.pattern));

		switch (accessRule.getProblemId()) {
			case IProblem.ForbiddenReference:
				parameters.put(TAG_KIND, TAG_NON_ACCESSIBLE);
				break;
			case IProblem.DiscouragedReference:
				parameters.put(TAG_KIND, TAG_DISCOURAGED);
				break;
			default:
				parameters.put(TAG_KIND, TAG_ACCESSIBLE);
				break;
		}
		if (accessRule.ignoreIfBetter())
			parameters.put(TAG_IGNORE_IF_BETTER, "true"); //$NON-NLS-1$

		writer.printTag(TAG_ACCESS_RULE, parameters, indent, newLine, true);

	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:ClasspathEntry.java

示例4: encodeAccessRules

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
void encodeAccessRules(XMLWriter writer, boolean indent, boolean newLine) {

    writer.startTag(TAG_ACCESS_RULES, indent);
    AccessRule[] rules = getAccessRuleSet().getAccessRules();
    for (int i = 0, length = rules.length; i < length; i++) {
      encodeAccessRule(rules[i], writer, indent, newLine);
    }
    writer.endTag(TAG_ACCESS_RULES, indent, true /*insert new line*/);
  }
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:ClasspathEntry.java

示例5: getAccessRules

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
/** @see org.eclipse.jdt.core.IClasspathEntry#getAccessRules() */
public IAccessRule[] getAccessRules() {
  if (this.accessRuleSet == null) return NO_ACCESS_RULES;
  AccessRule[] rules = this.accessRuleSet.getAccessRules();
  int length = rules.length;
  if (length == 0) return NO_ACCESS_RULES;
  IAccessRule[] result = new IAccessRule[length];
  System.arraycopy(rules, 0, result, 0, length);
  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:ClasspathEntry.java

示例6: toProblemId

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
private static int toProblemId(int kind) {
	boolean ignoreIfBetter = (kind & IAccessRule.IGNORE_IF_BETTER) != 0;
	switch (kind & ~IAccessRule.IGNORE_IF_BETTER) {
		case K_NON_ACCESSIBLE:
			return ignoreIfBetter ? IProblem.ForbiddenReference | AccessRule.IgnoreIfBetter : IProblem.ForbiddenReference;
		case K_DISCOURAGED:
			return ignoreIfBetter ? IProblem.DiscouragedReference | AccessRule.IgnoreIfBetter : IProblem.DiscouragedReference;
		default:
			return ignoreIfBetter ? AccessRule.IgnoreIfBetter : 0;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:ClasspathAccessRule.java

示例7: readRestriction

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
private static AccessRuleSet readRestriction(DataInputStream in) throws IOException {
	int length = in.readInt();
	if (length == 0) return null; // no restriction specified
	AccessRule[] accessRules = new AccessRule[length];
	for (int i = 0; i < length; i++) {
		char[] pattern = readName(in);
		int problemId = in.readInt();
		accessRules[i] = new ClasspathAccessRule(pattern, problemId);
	}
	JavaModelManager manager = JavaModelManager.getJavaModelManager();
	return new AccessRuleSet(accessRules, in.readByte(), manager.intern(in.readUTF()));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:State.java

示例8: encodeAccessRules

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
void encodeAccessRules(XMLWriter writer, boolean indent, boolean newLine) {

		writer.startTag(TAG_ACCESS_RULES, indent);
		AccessRule[] rules = getAccessRuleSet().getAccessRules();
		for (int i = 0, length = rules.length; i < length; i++) {
			encodeAccessRule(rules[i], writer, indent, newLine);
		}
		writer.endTag(TAG_ACCESS_RULES, indent, true/*insert new line*/);
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:ClasspathEntry.java

示例9: getAccessRules

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
/**
 * @see IClasspathEntry#getAccessRules()
 */
public IAccessRule[] getAccessRules() {
	if (this.accessRuleSet == null) return NO_ACCESS_RULES;
	AccessRule[] rules = this.accessRuleSet.getAccessRules();
	int length = rules.length;
	if (length == 0) return NO_ACCESS_RULES;
	IAccessRule[] result = new IAccessRule[length];
	System.arraycopy(rules, 0, result, 0, length);
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:ClasspathEntry.java

示例10: getAccessRestriction

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
protected AccessRestriction getAccessRestriction(String packageName) {
  if (exportedPackages != null && !exportedPackages.contains(packageName)) {
    AccessRule rule = new AccessRule(null /* pattern */, IProblem.ForbiddenReference, true /* keep looking for accessible type */);
    return new AccessRestriction(rule, AccessRestriction.COMMAND_LINE, getEntryName());
  }
  return null;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:8,代码来源:DependencyClasspathEntry.java

示例11: ClasspathEntry

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
/** Creates a class path entry of the specified kind with the given path. */
public ClasspathEntry(
    int contentKind,
    int entryKind,
    IPath path,
    IPath[] inclusionPatterns,
    IPath[] exclusionPatterns,
    IPath sourceAttachmentPath,
    IPath sourceAttachmentRootPath,
    IPath specificOutputLocation,
    IClasspathEntry referencingEntry,
    boolean isExported,
    IAccessRule[] accessRules,
    boolean combineAccessRules,
    IClasspathAttribute[] extraAttributes) {

  this.contentKind = contentKind;
  this.entryKind = entryKind;
  this.path = path;
  this.inclusionPatterns = inclusionPatterns;
  this.exclusionPatterns = exclusionPatterns;
  this.referencingEntry = referencingEntry;

  int length;
  if (accessRules != null && (length = accessRules.length) > 0) {
    AccessRule[] rules = new AccessRule[length];
    System.arraycopy(accessRules, 0, rules, 0, length);
    byte classpathEntryType;
    String classpathEntryName;
    JavaModelManager manager = JavaModelManager.getJavaModelManager();
    if (this.entryKind == IClasspathEntry.CPE_PROJECT
        || this.entryKind
            == IClasspathEntry.CPE_SOURCE) { // can be remote source entry when reconciling
      classpathEntryType = AccessRestriction.PROJECT;
      classpathEntryName = manager.intern(getPath().segment(0));
    } else {
      classpathEntryType = AccessRestriction.LIBRARY;
      //                Object target = JavaModel.getWorkspaceTarget(path);
      //                if (target == null) {
      classpathEntryName = manager.intern(path.toOSString());
      //                } else {
      //                    classpathEntryName = manager.intern(path.makeRelative().toString());
      //                }
    }
    this.accessRuleSet = new AccessRuleSet(rules, classpathEntryType, classpathEntryName);
  }
  //		else { -- implicit!
  //			this.accessRuleSet = null;
  //		}

  this.combineAccessRules = combineAccessRules;
  this.extraAttributes = extraAttributes;

  if (inclusionPatterns != INCLUDE_ALL && inclusionPatterns.length > 0) {
    this.fullInclusionPatternChars = UNINIT_PATTERNS;
  }
  if (exclusionPatterns.length > 0) {
    this.fullExclusionPatternChars = UNINIT_PATTERNS;
  }
  this.sourceAttachmentPath = sourceAttachmentPath;
  this.sourceAttachmentRootPath = sourceAttachmentRootPath;
  this.specificOutputLocation = specificOutputLocation;
  this.isExported = isExported;
}
 
开发者ID:eclipse,项目名称:che,代码行数:65,代码来源:ClasspathEntry.java

示例12: ClasspathEntry

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
/**
	 * Creates a class path entry of the specified kind with the given path.
	 */
	public ClasspathEntry(
		int contentKind,
		int entryKind,
		IPath path,
		IPath[] inclusionPatterns,
		IPath[] exclusionPatterns,
		IPath sourceAttachmentPath,
		IPath sourceAttachmentRootPath,
		IPath specificOutputLocation,
		IClasspathEntry referencingEntry,
		boolean isExported,
		IAccessRule[] accessRules,
		boolean combineAccessRules,
		IClasspathAttribute[] extraAttributes) {

		this.contentKind = contentKind;
		this.entryKind = entryKind;
		this.path = path;
		this.inclusionPatterns = inclusionPatterns;
		this.exclusionPatterns = exclusionPatterns;
		this.referencingEntry = referencingEntry;
		
		int length;
		if (accessRules != null && (length = accessRules.length) > 0) {
			AccessRule[] rules = new AccessRule[length];
			System.arraycopy(accessRules, 0, rules, 0, length);
			byte classpathEntryType;
			String classpathEntryName;
			JavaModelManager manager = JavaModelManager.getJavaModelManager();
			if (this.entryKind == CPE_PROJECT || this.entryKind == CPE_SOURCE) { // can be remote source entry when reconciling
				classpathEntryType = AccessRestriction.PROJECT;
				classpathEntryName = manager.intern(getPath().segment(0));
			} else {
				classpathEntryType = AccessRestriction.LIBRARY;
				Object target = JavaModel.getWorkspaceTarget(path);
				if (target == null) {
					classpathEntryName = manager.intern(path.toOSString());
				} else {
					classpathEntryName = manager.intern(path.makeRelative().toString());
				}
			}
			this.accessRuleSet = new AccessRuleSet(rules, classpathEntryType, classpathEntryName);
		}
//		else { -- implicit!
//			this.accessRuleSet = null;
//		}

		this.combineAccessRules = combineAccessRules;
		this.extraAttributes = extraAttributes;

	    if (inclusionPatterns != INCLUDE_ALL && inclusionPatterns.length > 0) {
			this.fullInclusionPatternChars = UNINIT_PATTERNS;
	    }
	    if (exclusionPatterns.length > 0) {
			this.fullExclusionPatternChars = UNINIT_PATTERNS;
	    }
		this.sourceAttachmentPath = sourceAttachmentPath;
		this.sourceAttachmentRootPath = sourceAttachmentRootPath;
		this.specificOutputLocation = specificOutputLocation;
		this.isExported = isExported;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:65,代码来源:ClasspathEntry.java

示例13: forbidAll

import org.eclipse.jdt.internal.compiler.env.AccessRule; //导入依赖的package包/类
public static AccessRestrictionClasspathEntry forbidAll(DependencyClasspathEntry entry) {
  AccessRule accessRule = new AccessRule(null /* pattern */, IProblem.ForbiddenReference, true /* keep looking for accessible type */);
  AccessRestriction accessRestriction = new AccessRestriction(accessRule, AccessRestriction.COMMAND_LINE, entry.getEntryName());
  return new AccessRestrictionClasspathEntry(entry, accessRestriction);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:6,代码来源:AccessRestrictionClasspathEntry.java


注:本文中的org.eclipse.jdt.internal.compiler.env.AccessRule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。