• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PsiArrayType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: resolveFieldConfigType

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
Optional<PsiClass> resolveFieldConfigType(PsiField psiField) {
    PsiType fieldType = psiField.getType();
    if (fieldType instanceof PsiClassType) {
        PsiClassType fieldClassType = ((PsiClassType) fieldType);
        if (collectionType != null && collectionType.isAssignableFrom(fieldType) && fieldClassType.getParameterCount() == 1) {
            return toPsiClass(fieldClassType.getParameters()[0]);
        } else if (mapType != null && mapType.isAssignableFrom(fieldType) && fieldClassType.getParameterCount() == 2) {
            return toPsiClass(fieldClassType.getParameters()[1]);
        } else {
            return toPsiClass(fieldType);
        }
    } else if (fieldType instanceof PsiArrayType) {
        return toPsiClass(((PsiArrayType) fieldType).getComponentType());
    } else {
        return Optional.empty();
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:18,代码来源:CoffigResolver.java


示例2: maybeInferParamType

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
public static PsiType maybeInferParamType( TypeVarToTypeMap inferenceMap, PsiType ownersType, PsiType fromParamType, PsiType toParamType )
{
  int iCount = inferenceMap.size();

  PsiType toCompType = toParamType;
  while( toCompType instanceof PsiArrayType )
  {
    toCompType = ((PsiArrayType)toCompType).getComponentType();
  }
  if( isTypeVariable( toCompType ) || isParameterizedType( toCompType ) )
  {
    inferTypeVariableTypesFromGenParamTypeAndConcreteType_Reverse( toParamType, fromParamType, inferenceMap );
    if( inferenceMap.size() > iCount )
    {
      PsiType actualType = getActualType( toParamType, inferenceMap, false );
      toParamType = actualType == null ? toParamType : actualType;
    }
  }
  return replaceTypeVariableTypeParametersWithBoundingTypes( toParamType, ownersType );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:21,代码来源:TypeUtil.java


示例3: maybeInferReturnType

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
public static PsiType maybeInferReturnType( TypeVarToTypeMap inferenceMap, PsiType ownersType, PsiType fromReturnType, PsiType toReturnType )
{
  int iCount = inferenceMap.size();

  PsiType toCompType = toReturnType;
  while( toCompType instanceof PsiArrayType )
  {
    toCompType = ((PsiArrayType)toCompType).getComponentType();
  }
  boolean bTypeVar = isTypeVariable( toCompType );
  if( bTypeVar || isParameterizedType( toCompType ) )
  {
    inferTypeVariableTypesFromGenParamTypeAndConcreteType( toReturnType, fromReturnType, inferenceMap );
    if( bTypeVar && inferenceMap.get( (PsiClassType)toCompType ) != null || inferenceMap.size() > iCount )
    {
      PsiType actualType = getActualType( toReturnType, inferenceMap, false );
      toReturnType = actualType == null ? toReturnType : actualType;
    }
  }
  return replaceTypeVariableTypeParametersWithBoundingTypes( toReturnType, ownersType );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:22,代码来源:TypeUtil.java


示例4: getDefaultParameterizedType

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
public static PsiType getDefaultParameterizedType( PsiType type, PsiManager mgr )
{
  if( type.getArrayDimensions() > 0 )
  {
    PsiType defType = getDefaultParameterizedType( ((PsiArrayType)type).getComponentType(), mgr );
    if( !defType.equals( type ) )
    {
      return new PsiArrayType( defType );
    }
    return type;
  }
  if( type instanceof PsiIntersectionType )
  {
    return makeDefaultParameterizedTypeForCompoundType( (PsiIntersectionType)type, mgr );
  }
  if( type instanceof PsiDisjunctionType )
  {
    return getDefaultParameterizedType( PsiTypesUtil.getLowestUpperBoundClassType( (PsiDisjunctionType)type ), mgr );
  }
  if( !isGenericType( type ) && !isParameterizedType( type ) )
  {
    return type;
  }
  type = ((PsiClassType)type).rawType();
  return makeDefaultParameterizedType( type );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:27,代码来源:TypeUtil.java


示例5: calculateLookupItems

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
  if (params.length != 1) return null;
  LookupElement[] lookupItems = params[0].calculateLookupItems(context);
  if (lookupItems == null) return null;

  List<LookupElement> result = ContainerUtil.newArrayList();
  for (LookupElement element : lookupItems) {
    PsiTypeLookupItem lookupItem = element.as(PsiTypeLookupItem.CLASS_CONDITION_KEY);
    if (lookupItem != null) {
      PsiType psiType = lookupItem.getType();
      if (psiType instanceof PsiArrayType) {
        result.add(PsiTypeLookupItem.createLookupItem(((PsiArrayType)psiType).getComponentType(), null));
      }
    }
  }

  return lookupItems;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ComponentTypeOfMacro.java


示例6: visitField

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Override
public void visitField(@NotNull PsiField field) {
  super.visitField(field);
  if (!field.hasModifierProperty(PsiModifier.PUBLIC)) {
    return;
  }
  if (!field.hasModifierProperty(PsiModifier.STATIC)) {
    return;
  }
  final PsiType type = field.getType();
  if (!(type instanceof PsiArrayType)) {
    return;
  }
  if (CollectionUtils.isConstantEmptyArray(field)) {
    return;
  }
  registerFieldError(field);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PublicStaticArrayFieldInspection.java


示例7: inferExpectedSignatures

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull PsiMethod method,
                                               @NotNull PsiSubstitutor substitutor,
                                               @NotNull String[] options) {
  List<PsiType[]> signatures = new SecondParamHintProcessor().inferExpectedSignatures(method, substitutor, options);
  if (signatures.size() == 1) {
    PsiType[] signature = signatures.get(0);
    if (signature.length == 1) {
      PsiType type = signature[0];
      if (type instanceof PsiArrayType) {
        return produceResult(((PsiArrayType)type).getComponentType());
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SecondParamHintProcessor.java


示例8: inferExpectedSignatures

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull PsiMethod method,
                                               @NotNull PsiSubstitutor substitutor,
                                               @NotNull String[] options) {
  List<PsiType[]> signatures = new ThirdParamHintProcessor().inferExpectedSignatures(method, substitutor, options);
  if (signatures.size() == 1) {
    PsiType[] signature = signatures.get(0);
    if (signature.length == 1) {
      PsiType type = signature[0];
      if (type instanceof PsiArrayType) {
        return produceResult(((PsiArrayType)type).getComponentType());
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ThirdParamHintProcessor.java


示例9: inferExpectedSignatures

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull PsiMethod method,
                                               @NotNull PsiSubstitutor substitutor,
                                               @NotNull String[] options) {
  List<PsiType[]> signatures = new FirstParamHintProcessor().inferExpectedSignatures(method, substitutor, options);
  if (signatures.size() == 1) {
    PsiType[] signature = signatures.get(0);
    if (signature.length == 1) {
      PsiType type = signature[0];
      if (type instanceof PsiArrayType) {
        return produceResult(((PsiArrayType)type).getComponentType());
      }
    }
  }
  return Collections.emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FirstParamHintProcessor.java


示例10: isValidArrayOrPrimitiveType

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
/**
 * Returns false if <code>type</code> is a multiple levels of collections or arrays. Returns true
 * otherwise.
 *
 * @param type The PsiType been validated.
 * @param project The project that has the PsiElement associated with <code>type</code>.
 */
public boolean isValidArrayOrPrimitiveType(PsiType type, Project project) {
  if (type instanceof PsiArrayType) {
    PsiArrayType arrayType = (PsiArrayType) type;
    if (arrayType.getComponentType() instanceof PsiPrimitiveType) {
      return true;
    } else {
      return isValidInnerArrayType(arrayType.getComponentType(), project);
    }
  }

  // Check if type is a Collection
  PsiClassType collectionType =
      JavaPsiFacade.getElementFactory(project).createTypeByFQClassName("java.util.Collection");
  if (collectionType.isAssignableFrom(type)) {
    assert (type instanceof PsiClassType);
    PsiClassType classType = (PsiClassType) type;
    PsiType[] typeParams = classType.getParameters();
    assert (typeParams.length > 0);
    return isValidInnerArrayType(typeParams[0], project);
  }

  return true;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:31,代码来源:MethodParameterTypeInspection.java


示例11: calculateLookupItems

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
  if (params.length != 1) return null;
  LookupElement[] lookupItems = params[0].calculateLookupItems(context);
  if (lookupItems == null) return null;

  List<LookupElement> result = ContainerUtil.newArrayList();
  for (LookupElement element : lookupItems) {
    PsiTypeLookupItem lookupItem = element.as(PsiTypeLookupItem.CLASS_CONDITION_KEY);
    if (lookupItem != null) {
      PsiType psiType = lookupItem.getPsiType();
      if (psiType instanceof PsiArrayType) {
        result.add(PsiTypeLookupItem.createLookupItem(((PsiArrayType)psiType).getComponentType(), null));
      }
    }
  }

  return lookupItems;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ComponentTypeOfMacro.java


示例12: getAugments

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@NotNull
@Override
@SuppressWarnings("unchecked")
public <Psi extends PsiElement> List<Psi> getAugments(@NotNull PsiElement element, @NotNull Class<Psi> type)
{
	if(type == PsiMethod.class && element instanceof PsiClass && element.getUserData(FLAG) == Boolean.TRUE && ((PsiClass) element).isEnum())
	{
		List<Psi> list = new ArrayList<Psi>(2);

		LightMethodBuilder valuesMethod = new LightMethodBuilder(element.getManager(), JavaLanguage.INSTANCE, VALUES_METHOD_NAME);
		valuesMethod.setContainingClass((PsiClass) element);
		valuesMethod.setMethodReturnType(new PsiArrayType(new PsiImmediateClassType((PsiClass)element, PsiSubstitutor.EMPTY)));
		valuesMethod.addModifiers(PsiModifier.PUBLIC, PsiModifier.STATIC);
		list.add((Psi) valuesMethod);

		LightMethodBuilder valueOfMethod = new LightMethodBuilder(element.getManager(), JavaLanguage.INSTANCE, VALUE_OF_METHOD_NAME);
		valueOfMethod.setContainingClass((PsiClass) element);
		valueOfMethod.setMethodReturnType(new PsiImmediateClassType((PsiClass) element, PsiSubstitutor.EMPTY));
		valueOfMethod.addModifiers(PsiModifier.PUBLIC, PsiModifier.STATIC);
		valueOfMethod.addParameter("name", JavaClassNames.JAVA_LANG_STRING);
		valueOfMethod.addException(JavaClassNames.JAVA_LANG_ILLEGAL_ARGUMENT_EXCEPTION);
		list.add((Psi) valueOfMethod);
		return list;
	}
	return Collections.emptyList();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:JavaEnumAugmentProvider.java


示例13: getTypeShortName

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Nullable
private static String getTypeShortName(@NotNull final PsiType type)
{
	if(type instanceof PsiPrimitiveType)
	{
		return ((PsiPrimitiveType) type).getBoxedTypeName();
	}
	if(type instanceof PsiClassType)
	{
		return ((PsiClassType) type).getClassName();
	}
	if(type instanceof PsiArrayType)
	{
		return getTypeShortName(((PsiArrayType) type).getComponentType()) + "[]";
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:PsiMethodWithOverridingPercentMember.java


示例14: getTooltip

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Override
public String getTooltip(MemberInfo memberInfo)
{
	if(isMemberEnabled(memberInfo))
	{
		return null;
	}
	if(!(memberInfo.getMember() instanceof PsiField))
	{
		return CodeInsightBundle.message("generate.equals.hashcode.internal.error");
	}
	final PsiField field = (PsiField) memberInfo.getMember();
	final PsiType type = field.getType();
	if(!(type instanceof PsiArrayType) || JavaVersionService.getInstance().isAtLeast(field, JavaSdkVersion.JDK_1_5))
	{
		return null;
	}
	return CodeInsightBundle.message("generate.equals.hashcode.warning.hashcode.for.arrays.is.not.supported");
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:GenerateEqualsWizard.java


示例15: arrayOf

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
public PsiTypePattern arrayOf(final ElementPattern pattern) {
  return with(new PatternCondition<PsiType>("arrayOf") {
    public boolean accepts(@NotNull final PsiType psiType, final ProcessingContext context) {
      return psiType instanceof PsiArrayType &&
             pattern.accepts(((PsiArrayType)psiType).getComponentType(), context);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PsiTypePattern.java


示例16: createClassFilter

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@NotNull
public static TargetClassFilter createClassFilter(@Nullable PsiType psiType) {
  if(psiType == null || psiType instanceof PsiArrayType) {
    return TargetClassFilter.ALL;
  }
  PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
  if (psiClass != null) {
    return createClassFilter(psiClass);
  }
  return new FQNameClassFilter(psiType.getCanonicalText());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FieldEvaluator.java


示例17: create

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Nullable
public static TargetType create(final PsiArrayType arrayType) {
  PsiType currentComponentType = arrayType.getComponentType();
  while (currentComponentType instanceof PsiArrayType) {
    currentComponentType = ((PsiArrayType)currentComponentType).getComponentType();
  }
  if (!(currentComponentType instanceof PsiClassType)) {
    return null;
  }
  final String targetQName = arrayType.getCanonicalText();
  return new TargetType(targetQName, true, arrayType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:TargetType.java


示例18: isConvertible

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Nullable
@Override
public Boolean isConvertible(@NotNull PsiType lType, @NotNull PsiType rType, @NotNull GroovyPsiElement context) {
  if (lType instanceof PsiArrayType) {
    PsiType lComponentType = ((PsiArrayType)lType).getComponentType();
    PsiType rComponentType = ClosureParameterEnhancer.findTypeForIteration(rType, context);
    if (rComponentType != null && TypesUtil.isAssignable(lComponentType, rComponentType, context)) {
      return Boolean.TRUE;
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GrContainerConverter.java


示例19: isValidInnerArrayType

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
/**
 * Returns false is <code>type</code> is an array or a java.util.Collection or one of its
 * subtypes. Returns true otherwise.
 *
 * @param type The PsiType been validated.
 * @param project The project that has the PsiElement associated with <code>type</code>.
 */
public boolean isValidInnerArrayType(PsiType type, Project project) {
  if (type instanceof PsiArrayType) {
    return false;
  }

  // Check if type is a Collection
  PsiClassType collectionType =
      JavaPsiFacade.getElementFactory(project).createTypeByFQClassName("java.util.Collection");
  if (collectionType.isAssignableFrom(type)) {
    return false;
  }

  return true;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:22,代码来源:MethodParameterTypeInspection.java


示例20: visitArrayType

import com.intellij.psi.PsiArrayType; //导入依赖的package包/类
@Nullable
@Override
public TypeBuilder visitArrayType(PsiArrayType arrayType) {
    boxed = false; // don't need to (or want to) box array types
    arrayType.getComponentType().accept(this);
    typeBuilder.withArrayDimensions(arrayType.getArrayDimensions());
    return super.visitArrayType(arrayType);
}
 
开发者ID:mistraltechnologies,项目名称:smogen,代码行数:9,代码来源:PsiTypeConverter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LegacyServerSocketEndPointInfo类代码示例发布时间:2022-05-22
下一篇:
Java ModelLoader类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap