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


Java Field.isConstant方法代码示例

本文整理汇总了Java中com.jetbrains.php.lang.psi.elements.Field.isConstant方法的典型用法代码示例。如果您正苦于以下问题:Java Field.isConstant方法的具体用法?Java Field.isConstant怎么用?Java Field.isConstant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jetbrains.php.lang.psi.elements.Field的用法示例。


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

示例1: getAnnotations

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
public static Set<String> getAnnotations(Project project, String className) {

        HashSet<String> map = new HashSet<>();

        PhpClass phpClass = PhpElementsUtil.getClass(project, className);
        if(phpClass == null) {
            return map;
        }

        for(Field field: phpClass.getFields()) {
            if(!field.isConstant()) {
                map.add(field.getName());
            }
        }

        return map;
    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:18,代码来源:DoctrineYamlAnnotationLookupBuilder.java

示例2: getLookupElements

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<LookupElement> getLookupElements() {
    String modelNameInScope = DoctrineMetadataUtil.findModelNameInScope(getElement());
    if(modelNameInScope == null) {
        return Collections.emptyList();
    }

    Set<String> unique = new HashSet<>();

    Collection<LookupElement> lookupElements = new ArrayList<>();
    for (PhpClass phpClass : PhpElementsUtil.getClassesInterface(getProject(), modelNameInScope)) {
        for (Field field : phpClass.getFields()) {
            if(field.isConstant() || unique.contains(field.getName())) {
                continue;
            }

            String name = field.getName();
            unique.add(name);
            lookupElements.add(LookupElementBuilder.create(name).withIcon(field.getIcon()).withTypeText(phpClass.getPresentableFQN(), true));
        }
    }

    return lookupElements;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:26,代码来源:DoctrineTypeGotoCompletionRegistrar.java

示例3: multiResolve

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {

    List<PsiElement> psiElements = new ArrayList<>();

    String content = ((StringLiteralExpression) getElement()).getContents();
    for(Field field: constraintPhpClass.getFields()) {
        String name = field.getName();
        if(!field.isConstant() && field.getModifier().isPublic() && content.equals(name)) {
            psiElements.add(field);
        }
    }

    return PsiElementResolveResult.createResults(psiElements);
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:17,代码来源:ConstraintPropertyReference.java

示例4: getVariants

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
@NotNull
@Override
public Object[] getVariants() {

    List<LookupElement> lookupElements = new ArrayList<>();

    for(Field field: constraintPhpClass.getFields()) {
        if(!field.isConstant() && field.getModifier().isPublic()) {

            LookupElementBuilder lookupElement = LookupElementBuilder.create(field.getName()).withIcon(Symfony2Icons.SYMFONY);

            String defaultValue = PhpElementsUtil.getStringValue(field.getDefaultValue());
            if(defaultValue != null) {
                lookupElement = lookupElement.withTypeText(defaultValue, true);
            }

            lookupElements.add(lookupElement);
        }
    }

    return lookupElements.toArray();
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:23,代码来源:ConstraintPropertyReference.java

示例5: multiResolve

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(boolean b) {
    PhpIndex phpIndex = PhpIndex.getInstance(getElement().getProject());
    List<String> parts = StringUtil.split(
        PhpLangUtil.toFQN(
            StringUtil.unquoteString(getElement().getText())
        ),
        "::"
    );

    if (parts.size() != 2) {
        return new ResolveResult[0];
    }

    String className = parts.get(0);
    String constantName = parts.get(1);

    List<ResolveResult> fields = new ArrayList<ResolveResult>();
    Collection<PhpClass> classesAndInterfaces = new ArrayList<>();
    classesAndInterfaces.addAll(phpIndex.getClassesByFQN(className));
    classesAndInterfaces.addAll(phpIndex.getInterfacesByFQN(className));

    for (PhpClass phpClass: classesAndInterfaces) {
        for(Field field: phpClass.getFields()) {
            if (field.isConstant() && field.getName().equals(constantName)) {
                fields.add(new PsiElementResolveResult(field));
            }
        }
    }

    return fields.toArray(new ResolveResult[fields.size()]);
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:34,代码来源:ConstantReference.java

示例6: getTargetsForConstant

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
/**
 * Foobar::CONST
 */
@NotNull
public static Collection<PsiElement> getTargetsForConstant(@NotNull Project project, @NotNull String contents) {
    // FOO
    if (!contents.contains(":")) {
        if(!contents.startsWith("\\")) {
            contents = "\\" + contents;
        }

        return new ArrayList<>(
            PhpIndex.getInstance(project).getConstantsByFQN(contents)
        );
    }

    contents = contents.replaceAll(":+", ":");
    String[] split = contents.split(":");

    Collection<PsiElement> psiElements = new ArrayList<>();
    for (PhpClass phpClass : PhpElementsUtil.getClassesInterface(project, split[0])) {
        Field fieldByName = phpClass.findFieldByName(split[1], true);
        if(fieldByName != null && fieldByName.isConstant()) {
            psiElements.add(fieldByName);
        }
    }

    return psiElements;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:30,代码来源:ServiceContainerUtil.java

示例7: getVariants

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
@NotNull
@Override
public Object[] getVariants() {
    List<LookupElement> lookupElements = new ArrayList<>();

    for(Field field: this.phpClass.getFields()) {
        if(!field.isConstant()) {
            LookupElementBuilder lookupElement = LookupElementBuilder.createWithIcon(field);
            lookupElement = attachLookupInformation(field, lookupElement);
            lookupElements.add(lookupElement);
        }
    }

    return lookupElements.toArray();
}
 
开发者ID:Haehnchen,项目名称:idea-php-annotation-plugin,代码行数:16,代码来源:DoctrinePhpClassFieldReference.java

示例8: getMetadata

import com.jetbrains.php.lang.psi.elements.Field; //导入方法依赖的package包/类
@Override
public DoctrineMetadataModel getMetadata(@NotNull DoctrineMappingDriverArguments args) {

    PsiFile psiFile = args.getPsiFile();
    if(!(psiFile instanceof PhpFile)) {
        return null;
    }

    Collection<DoctrineModelField> fields = new ArrayList<>();
    DoctrineMetadataModel model = new DoctrineMetadataModel(fields);

    for (PhpClass phpClass : PhpElementsUtil.getClassesInterface(args.getProject(), args.getClassName())) {

        // remove duplicate code
        // @TODO: fr.adrienbrault.idea.symfony2plugin.doctrine.EntityHelper.getModelFields()
        PhpDocComment docComment = phpClass.getDocComment();
        if(docComment == null) {
            continue;
        }

        // Doctrine ORM
        // @TODO: external split
        if(AnnotationBackportUtil.hasReference(docComment, "\\Doctrine\\ORM\\Mapping\\Entity", "\\TYPO3\\Flow\\Annotations\\Entity")) {

            // @TODO: reuse annotations plugin
            PhpDocTag phpDocTag = AnnotationBackportUtil.getReference(docComment, "\\Doctrine\\ORM\\Mapping\\Table");
            if(phpDocTag != null) {
                Matcher matcher = Pattern.compile("name[\\s]*=[\\s]*[\"|']([\\w_\\\\]+)[\"|']").matcher(phpDocTag.getText());
                if (matcher.find()) {
                    model.setTable(matcher.group(1));
                }
            }

            for(Field field: phpClass.getFields()) {
                if(field.isConstant()) {
                    continue;
                }

                if(AnnotationBackportUtil.hasReference(field.getDocComment(), EntityHelper.ANNOTATION_FIELDS)) {
                    DoctrineModelField modelField = new DoctrineModelField(field.getName());
                    EntityHelper.attachAnnotationInformation(field, modelField.addTarget(field));
                    fields.add(modelField);
                }
            }
        }

    }

    if(fields.size() == 0) {
        return null;
    }


    return model;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:56,代码来源:DoctrinePhpMappingDriver.java


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