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


Java Flags.isPublic方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.Flags.isPublic方法的典型用法代码示例。如果您正苦于以下问题:Java Flags.isPublic方法的具体用法?Java Flags.isPublic怎么用?Java Flags.isPublic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.Flags的用法示例。


在下文中一共展示了Flags.isPublic方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseVertigoDtoField

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static void parseVertigoDtoField(IMethod method, List<DtoField> fields) {
	try {
		if (method.isConstructor() || !Flags.isPublic(method.getFlags())) {
			return;
		}
		IAnnotation fieldAnnotation = JdtUtils.getAnnotation(method, FIELD_ANNOTATION_NAME);
		if (fieldAnnotation == null) {
			return;
		}
		String domain = (String) JdtUtils.getMemberValue(fieldAnnotation, DOMAIN_FIELD_NAME);

		/* Cas d'un champ de composition DTO/DTC : on filtre. */
		if (domain == null || domain.startsWith(DTO_DOMAIN_PREFIX)) {
			return;
		}

		String constantCaseName = StringUtils.toConstantCase(KspStringUtils.getFieldNameFromGetter(method.getElementName()));
		String label = (String) JdtUtils.getMemberValue(fieldAnnotation, LABEL_FIELD_NAME);
		Boolean persistent = (Boolean) JdtUtils.getMemberValue(fieldAnnotation, PERSISTENT_FIELD_NAME);

		DtoField field = new DtoField(constantCaseName, label, domain, persistent);
		fields.add(field);
	} catch (JavaModelException e) {
		ErrorUtils.handle(e);
	}
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:27,代码来源:DtoUtils.java

示例2: isKasper3DtoType

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Indique si le type donné est un DtObject Kasper 3.
 * 
 * @param type Type JDT.
 * @return <code>true</code> si le type est un DtObject.
 */
public static boolean isKasper3DtoType(IType type) {
	try {
		/* Vérifie que c'est une classe publique. */
		if (!type.isClass() || !Flags.isPublic(type.getFlags())) {
			return false;
		}
		/* Vérifie que la classe hérite de SuperDtObject */
		if (type.getSuperclassName() == null) {
			return false;
		}
		return "SuperDtObject".equals(type.getSuperclassName()) || "kasper.model.SuperDtObject".equals(type.getSuperclassName());

	} catch (JavaModelException e) {
		ErrorUtils.handle(e);
	}
	return false;
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:24,代码来源:JdtUtils.java

示例3: isKasper345DtoType

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Indique si le type donné est un DtObject Kasper 4 ou 5.
 * 
 * @param type Type JDT.
 * @return <code>true</code> si le type est un DtObject.
 */
public static boolean isKasper345DtoType(IType type) {
	try {
		/* Vérifie que c'est une classe publique. */
		if (!type.isClass() || !Flags.isPublic(type.getFlags())) {
			return false;
		}
		/* Vérifie que la classe hérite d'un abstract de même nom préfixé ou suffixé par Abstract */
		String superclassName = type.getSuperclassName();
		if (superclassName == null) {
			return false;
		}
		String prefixedName = "Abstract" + type.getElementName();
		String suffixedName = type.getElementName() + "Abstract";

		return superclassName.equals(prefixedName) || superclassName.equals(suffixedName);

	} catch (JavaModelException e) {
		ErrorUtils.handle(e);
	}
	return false;
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:28,代码来源:JdtUtils.java

示例4: isSubclass

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Indique si le type donné est une sous-classe direct d'un type parmi une liste.
 * 
 * @param type Type JDT.
 * @param parentClasses Liste des classes parentes candidates.
 * @return <code>true</code> si le type est une sous-classe.
 */
public static boolean isSubclass(IType type, List<String> parentClasses) {
	if (parentClasses == null || parentClasses.isEmpty()) {
		return false;
	}
	try {
		/* Vérifie que c'est une classe publique. */
		if (!type.isClass() || !Flags.isPublic(type.getFlags())) {
			return false;
		}
		/* Vérifie que la classe hérite d'une classe (autre que Object) */
		String superclassName = type.getSuperclassName();
		if (superclassName == null) {
			return false;
		}

		/* Vérifie que la classe parente est parmi les candidates. */
		return parentClasses.contains(superclassName);

	} catch (JavaModelException e) {
		ErrorUtils.handle(e);
	}
	return false;
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:31,代码来源:JdtUtils.java

示例5: isVisible

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private boolean isVisible(TypeNameMatch curr) {
	int flags= curr.getModifiers();
	if (Flags.isPrivate(flags)) {
		return false;
	}
	boolean isPublic;
	try {
		isPublic= JdtFlags.isPublic(curr.getType());
	} catch (JavaModelException e) {
		isPublic= Flags.isPublic(flags);
	}
	if (isPublic || Flags.isProtected(flags)) {
		return true;
	}
	return curr.getPackageName().equals(fCurrPackage.getElementName());
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:17,代码来源:OrganizeImportsOperation.java

示例6: getMethodModifier

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Returns the method modifier as String.
 * 
 * @param method
 * @return method modifier
 * @throws JavaModelException
 */
public static String getMethodModifier(IMethod method)
		throws JavaModelException {
	int methodFlags = method.getFlags();

	if (Flags.isPublic(methodFlags)) {
		return MOD_PUBLIC;
	} else if (Flags.isProtected(methodFlags)) {
		return MOD_PROTECTED;
	} else if (Flags.isPrivate(methodFlags)) {
		return MOD_PRIVATE;
	} else if (Flags.isPackageDefault(methodFlags)) {
		return MOD_PACKAGE;
	}

	return ""; //$NON-NLS-1$
}
 
开发者ID:junit-tools-team,项目名称:junit-tools,代码行数:24,代码来源:JDTUtils.java

示例7: isVisible

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Evaluates if a member (possible from another package) is visible from elements in a package.
 *
 * @param member The member to test the visibility for
 * @param pack The package in focus
 * @return returns <code>true</code> if the member is visible from the package
 * @throws JavaModelException thrown when the member can not be accessed
 */
public static boolean isVisible(IMember member, IPackageFragment pack) throws JavaModelException {

  int type = member.getElementType();
  if (type == IJavaElement.INITIALIZER
      || (type == IJavaElement.METHOD
          && member.getElementName().startsWith("<"))) { // $NON-NLS-1$
    return false;
  }

  int otherflags = member.getFlags();
  IType declaringType = member.getDeclaringType();
  if (Flags.isPublic(otherflags)
      || (declaringType != null && isInterfaceOrAnnotation(declaringType))) {
    return true;
  } else if (Flags.isPrivate(otherflags)) {
    return false;
  }

  IPackageFragment otherpack =
      (IPackageFragment) member.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
  return (pack != null && otherpack != null && isSamePackage(pack, otherpack));
}
 
开发者ID:eclipse,项目名称:che,代码行数:31,代码来源:JavaModelUtil.java

示例8: isTestMethod

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
@Override
public boolean isTestMethod(IMethod method, ICompilationUnit compilationUnit) {
  try {
    int flags = method.getFlags();
    // 'V' is void signature
    return !(method.isConstructor()
            || !Flags.isPublic(flags)
            || Flags.isAbstract(flags)
            || Flags.isStatic(flags)
            || !"V".equals(method.getReturnType()))
        && javaTestFinder.isTest(
            method, compilationUnit, JavaTestAnnotations.JUNIT4X_TEST.getName());

  } catch (JavaModelException ignored) {
    return false;
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:JUnit4TestRunner.java

示例9: createProposal

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static JavaCompletionProposal createProposal(int flags,
    String replacementString, int replacementOffset, int numCharsFilled, 
    int numCharsToOverwrite, String displayString) {
  Image image;
  GWTPlugin plugin = GWTPlugin.getDefault();
  if (Flags.isPublic(flags)) {
    image = plugin.getImage(GWTImages.JSNI_PUBLIC_METHOD_SMALL);
  } else if (Flags.isPrivate(flags)) {
    image = plugin.getImage(GWTImages.JSNI_PRIVATE_METHOD_SMALL);
  } else if (Flags.isProtected(flags)) {
    image = plugin.getImage(GWTImages.JSNI_PROTECTED_METHOD_SMALL);
  } else {
    image = plugin.getImage(GWTImages.JSNI_DEFAULT_METHOD_SMALL);
  }
  replacementString = replacementString.substring(numCharsFilled);
  return new JavaCompletionProposal(replacementString, replacementOffset,
      numCharsToOverwrite, image, "/*-{ " + displayString + " }-*/;", 0);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:JsniMethodBodyCompletionProposalComputer.java

示例10: isVisibleInHierarchy

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Evaluates if a member in the focus' element hierarchy is visible from elements in a package.
 *
 * @param member The member to test the visibility for
 * @param pack The package of the focus element focus
 * @return returns <code>true</code> if the member is visible from the package
 * @throws JavaModelException thrown when the member can not be accessed
 */
public static boolean isVisibleInHierarchy(IMember member, IPackageFragment pack)
    throws JavaModelException {
  int type = member.getElementType();
  if (type == IJavaElement.INITIALIZER
      || (type == IJavaElement.METHOD
          && member.getElementName().startsWith("<"))) { // $NON-NLS-1$
    return false;
  }

  int otherflags = member.getFlags();

  IType declaringType = member.getDeclaringType();
  if (Flags.isPublic(otherflags)
      || Flags.isProtected(otherflags)
      || (declaringType != null && isInterfaceOrAnnotation(declaringType))) {
    return true;
  } else if (Flags.isPrivate(otherflags)) {
    return false;
  }

  IPackageFragment otherpack =
      (IPackageFragment) member.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
  return (pack != null && pack.equals(otherpack));
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:JavaModelUtil.java

示例11: addMethodsToClass

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private void addMethodsToClass(IMethod iMethod) throws JavaModelException {
	if (iMethod.isConstructor() || iMethod.isMainMethod() || isMethodDepricated(iMethod)) {
		return;
	} else {
		if (Flags.isPublic(iMethod.getFlags()) && Flags.isStatic(iMethod.getFlags())) {
			if (StringUtils.isBlank(iMethod.getSource())) {
				methodList.add(new MethodDetails(iMethod,cName, false));
			} else
				methodList.add(new MethodDetails(iMethod,cName, true));
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:13,代码来源:ClassDetails.java

示例12: parseKasper5DtoField

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static void parseKasper5DtoField(IMethod method, List<DtoField> fields) {
	try {
		if (method.isConstructor() || !Flags.isPublic(method.getFlags())) {
			return;
		}
		IAnnotation fieldAnnotation = JdtUtils.getAnnotation(method, FIELD_ANNOTATION_NAME);
		if (fieldAnnotation == null) {
			return;
		}
		String domain = (String) JdtUtils.getMemberValue(fieldAnnotation, DOMAIN_FIELD_NAME);

		/* Cas d'un champ de composition DTO/DTC : on filtre. */
		if (domain == null || domain.startsWith(DTO_DOMAIN_PREFIX)) {
			return;
		}

		IAnnotation columnAnnotation = JdtUtils.getAnnotation(method, COLUMN_ANNOTATION_NAME);
		if (columnAnnotation == null) {
			return;
		}

		String constantCaseName = (String) JdtUtils.getMemberValue(columnAnnotation, NAME_FIELD_NAME);
		String label = (String) JdtUtils.getMemberValue(fieldAnnotation, LABEL_FIELD_NAME);
		Boolean persistent = (Boolean) JdtUtils.getMemberValue(fieldAnnotation, PERSISTENT_FIELD_NAME);

		DtoField field = new DtoField(constantCaseName, label, domain, persistent);
		fields.add(field);
	} catch (JavaModelException e) {
		ErrorUtils.handle(e);
	}
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:32,代码来源:DtoUtils.java

示例13: parseKasper3BeanFieldGetter

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
private static DtoField parseKasper3BeanFieldGetter(IMethod method) throws JavaModelException {
	if (method.isConstructor() || !Flags.isPublic(method.getFlags()) || !Flags.isFinal(method.getFlags())) {
		return null;
	}
	String methodName = method.getElementName();
	if (!methodName.startsWith("get")) {
		return null;
	}

	String constantCaseName = StringUtils.toConstantCase(KspStringUtils.getFieldNameFromGetter(method.getElementName()));
	String label = "Unknown";
	Boolean persistent = false;

	return new DtoField(constantCaseName, label, "Unknown", persistent);
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:16,代码来源:DtoUtils.java

示例14: isVertigoDtoType

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
/**
 * Indique si le type donné est un DtObject Vertigo.
 * 
 * @param type Type JDT.
 * @return <code>true</code> si le type est un DtObject.
 */
public static boolean isVertigoDtoType(IType type) {
	try {
		/* Vérifie que c'est une classe publique final. */
		if (!type.isClass() || !Flags.isPublic(type.getFlags()) || !Flags.isFinal(type.getFlags())) {
			return false;
		}
		/* Vérifie les interfaces. */
		return hasVertigoDtoTypeInterface(type);
	} catch (JavaModelException e) {
		ErrorUtils.handle(e);
	}
	return false;
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:20,代码来源:JdtUtils.java

示例15: isVisibleMember

import org.eclipse.jdt.core.Flags; //导入方法依赖的package包/类
static boolean isVisibleMember(IMember member) throws JavaModelException {
	int f = member.getFlags();
	IType jType = member.getDeclaringType();
	return 
		jType.getPackageFragment().isDefaultPackage() && (Flags.isPackageDefault(f) || Flags.isProtected(f) || Flags.isPublic(f))
	||
		Flags.isPublic(f);

}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:10,代码来源:ObjectModel.java


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