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


Java PsiArrayType类代码示例

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


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


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