本文整理汇总了Java中org.eclipse.jdt.core.IMethod.isConstructor方法的典型用法代码示例。如果您正苦于以下问题:Java IMethod.isConstructor方法的具体用法?Java IMethod.isConstructor怎么用?Java IMethod.isConstructor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IMethod
的用法示例。
在下文中一共展示了IMethod.isConstructor方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleType
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private void handleType(IType type, IFile file, List<ServiceImplementation> serviceImplementations) throws JavaModelException {
/* Parcourt les méthodes. */
for (IMethod method : type.getMethods()) {
/* Filtre pour ne garder que les méthodes publiques d'instance */
if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
continue;
}
/* Créé le ServiceImplementation. */
String javaName = method.getElementName();
ISourceRange nameRange = method.getNameRange();
FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
ServiceImplementation serviceImplementation = new ServiceImplementation(fileRegion, javaName);
serviceImplementations.add(serviceImplementation);
}
}
示例2: handleType
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private void handleType(IType type, IFile file, List<DaoImplementation> daoImplementations) throws JavaModelException {
/* Parcourt les méthodes. */
for (IMethod method : type.getMethods()) {
/* Filtre pour ne garder que les méthodes publiques d'instance */
if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
continue;
}
/* Créé le DaoImplementation. */
String javaName = method.getElementName();
ISourceRange nameRange = method.getNameRange();
FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
DaoImplementation daoImplementation = new DaoImplementation(fileRegion, javaName);
daoImplementations.add(daoImplementation);
}
}
示例3: parseVertigoDtoField
import org.eclipse.jdt.core.IMethod; //导入方法依赖的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);
}
}
示例4: getInstanceMethods
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
public List<IMethod> getInstanceMethods() {
if(jType == null)
return Collections.emptyList();
try {
List<IMethod> list = new ArrayList<>();
IMethod[] methods = jType.getMethods();
for(IMethod m : methods)
if(!m.isConstructor() && !Flags.isStatic(m.getFlags()) && isMethodVisible(m))
list.add(m);
return list;
} catch (JavaModelException e) {
e.printStackTrace();
return Collections.emptyList();
}
// return info.getMethods(EnumSet.of(VisibilityInfo.PUBLIC));
}
示例5: addMethodsToClass
import org.eclipse.jdt.core.IMethod; //导入方法依赖的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));
}
}
}
示例6: handleMethod
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private void handleMethod(IMethod method, String pathPrefix, IFile file, List<WsRoute> wsRoutes) throws JavaModelException {
/* Filtre pour ne garder que les méthodes publiques d'instance */
if (method.isConstructor() || Flags.isStatic(method.getFlags()) || Flags.isPrivate(method.getFlags())) {
return;
}
/* Parcourt les verbes HTTP */
for (String verb : HTTP_VERBS) {
/* Extrait l'annotation du verbe. */
IAnnotation verbAnnotation = JdtUtils.getAnnotation(method, verb);
if (verbAnnotation == null) {
continue;
}
/* Extrait la route partielle. */
String routePatternSuffix = JdtUtils.getMemberValue(verbAnnotation);
/* Calcule la route complète. */
String routePattern = pathPrefix + routePatternSuffix;
/* Créé la WsRoute. */
String javaName = method.getElementName();
ISourceRange nameRange = method.getNameRange();
FileRegion fileRegion = new FileRegion(file, nameRange.getOffset(), nameRange.getLength());
WsRoute wsRoute = new WsRoute(fileRegion, javaName, routePattern, verb);
wsRoutes.add(wsRoute);
}
}
示例7: parseKasper5DtoField
import org.eclipse.jdt.core.IMethod; //导入方法依赖的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);
}
}
示例8: parseKasper3BeanFieldGetter
import org.eclipse.jdt.core.IMethod; //导入方法依赖的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);
}
示例9: getSootMethodSignature
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
/***** SootMethod signatures *****/
public static String getSootMethodSignature(IMethod iMethod) {
try {
StringBuilder name = new StringBuilder();
name.append("<");
name.append(iMethod.getDeclaringType().getFullyQualifiedName());
name.append(": ");
String retTypeName = resolveName(iMethod, iMethod.getReturnType());
if (retTypeName == null)
return null;
name.append(retTypeName);
name.append(" ");
if (iMethod.isConstructor())
name.append("<init>");
else
name.append(iMethod.getElementName());
name.append("(");
String comma = "";
String[] parameterTypes = iMethod.getParameterTypes();
for (int i = 0; i < iMethod.getParameterTypes().length; ++i) {
name.append(comma);
String readableName = resolveName(iMethod, parameterTypes[i]);
if (readableName == null)
return null;
name.append(readableName);
comma = ",";
}
name.append(")");
name.append(">");
return name.toString();
} catch (JavaModelException e) {
LOGGER.error("Error building Soot method signature", e);
return null;
}
}
示例10: isVirtual
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
private static boolean isVirtual(IMethod method) throws JavaModelException {
if (method.isConstructor()) {
return false;
}
if (JdtFlags.isPrivate(method)) {
return false;
}
if (JdtFlags.isStatic(method)) {
return false;
}
return true;
}
示例11: renameOccurrences
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
@Override
public void renameOccurrences(WorkspaceEdit edit, String newName, IProgressMonitor monitor) throws CoreException {
super.renameOccurrences(edit, newName, monitor);
IType t = (IType) fElement;
IMethod[] methods = t.getMethods();
for (IMethod method : methods) {
if (method.isConstructor()) {
TextEdit replaceEdit = new ReplaceEdit(method.getNameRange().getOffset(), method.getNameRange().getLength(), newName);
convert(edit, t.getCompilationUnit(), replaceEdit);
}
}
}
示例12: findReferences
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
protected List<CodeReference> findReferences(IType type) throws CoreException {
List<CodeReference> references = new ArrayList<>();
for (IMethod method : type.getMethods()) {
if (!method.isMainMethod() && !method.isConstructor() && !method.isLambdaMethod()) {
references.addAll(findReferences(method));
}
}
for (IField field : type.getFields()) {
references.addAll(findReferences(field));
}
return references;
}
示例13: getMethodComment
import org.eclipse.jdt.core.IMethod; //导入方法依赖的package包/类
/**
* Returns the comment for a method or constructor using the comment code templates (constructor / method / overriding method).
* <code>null</code> is returned if the template is empty.
* <p>The returned string is unformatted and not indented.
*
* @param method The method to be documented. The method must exist.
* @param overridden The method that will be overridden by the created method or
* <code>null</code> for non-overriding methods. If not <code>null</code>, the method must exist.
* @param lineDelimiter The line delimiter to be used.
* @return Returns the constructed comment or <code>null</code> if
* the comment code template is empty. The returned string is unformatted and and has no indent (formatting required).
* @throws CoreException Thrown when the evaluation of the code template fails.
*/
public static String getMethodComment(IMethod method, IMethod overridden, String lineDelimiter) throws CoreException {
String retType= method.isConstructor() ? null : method.getReturnType();
String[] paramNames= method.getParameterNames();
String[] typeParameterNames= StubUtility.shouldGenerateMethodTypeParameterTags(method.getJavaProject()) ? StubUtility.getTypeParameterNames(method.getTypeParameters()) : new String[0];
return StubUtility.getMethodComment(method.getCompilationUnit(), method.getDeclaringType().getElementName(),
method.getElementName(), paramNames, method.getExceptionTypes(), retType, typeParameterNames, overridden, false, lineDelimiter);
}