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


Java PsiVariable.getManager方法代码示例

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


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

示例1: addBuilderField

import com.intellij.psi.PsiVariable; //导入方法依赖的package包/类
public void addBuilderField(@NotNull List<PsiField> fields, @NotNull PsiVariable psiVariable, @NotNull PsiClass innerClass, @NotNull AccessorsInfo accessorsInfo, @NotNull PsiSubstitutor substitutor) {
  final String fieldName = accessorsInfo.removePrefix(psiVariable.getName());

  final Project project = psiVariable.getProject();
  final PsiManager psiManager = psiVariable.getManager();

  final PsiType psiFieldType = psiVariable.getType();

  final PsiType keyType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 0);
  final PsiType valueType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 1);

  final PsiType builderFieldKeyType = getBuilderFieldType(keyType, project);
  fields.add(new LombokLightFieldBuilder(psiManager, fieldName + LOMBOK_KEY, builderFieldKeyType)
    .withModifier(PsiModifier.PRIVATE)
    .withNavigationElement(psiVariable)
    .withContainingClass(innerClass));

  final PsiType builderFieldValueType = getBuilderFieldType(valueType, project);
  fields.add(new LombokLightFieldBuilder(psiManager, fieldName + LOMBOK_VALUE, builderFieldValueType)
    .withModifier(PsiModifier.PRIVATE)
    .withNavigationElement(psiVariable)
    .withContainingClass(innerClass));
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:24,代码来源:SingularMapHandler.java

示例2: appendBuildPrepare

import com.intellij.psi.PsiVariable; //导入方法依赖的package包/类
@Override
public void appendBuildPrepare(@NotNull StringBuilder buildMethodCode, @NotNull PsiVariable psiVariable, @NotNull String fieldName) {
  final PsiManager psiManager = psiVariable.getManager();
  final PsiType psiFieldType = psiVariable.getType();

  final PsiType rowKeyType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 0);
  final PsiType columnKeyType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 1);
  final PsiType valueType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, COM_GOOGLE_COMMON_COLLECT_TABLE, 2);

  buildMethodCode.append(MessageFormat.format(
    "{4}<{1}, {2}, {3}> {0} = " +
      "this.{0} == null ? " +
      "{4}.<{1}, {2}, {3}>of() : " +
      "this.{0}.build();\n",
    fieldName, rowKeyType.getCanonicalText(false), columnKeyType.getCanonicalText(false), valueType.getCanonicalText(false), collectionQualifiedName));
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:17,代码来源:SingularGuavaTableHandler.java

示例3: addBuilderMethod

import com.intellij.psi.PsiVariable; //导入方法依赖的package包/类
@Override
public void addBuilderMethod(@NotNull List<PsiMethod> methods, @NotNull PsiVariable psiVariable, @NotNull String fieldName, @NotNull PsiClass innerClass, boolean fluentBuilder, PsiType returnType, String singularName, PsiSubstitutor builderSubstitutor) {
  final PsiType psiFieldType = builderSubstitutor.substitute(psiVariable.getType());
  final PsiManager psiManager = psiVariable.getManager();

  final LombokLightMethodBuilder oneAddMethod = new LombokLightMethodBuilder(psiManager, singularName)
    .withMethodReturnType(returnType)
    .withContainingClass(innerClass)
    .withNavigationElement(psiVariable)
    .withModifier(PsiModifier.PUBLIC);

  addOneMethodParameter(oneAddMethod, psiFieldType, singularName);
  oneAddMethod.withBody(createOneAddMethodCodeBlock(innerClass, fluentBuilder, singularName, fieldName, psiFieldType));
  methods.add(oneAddMethod);

  final LombokLightMethodBuilder allAddMethod = new LombokLightMethodBuilder(psiManager, fieldName)
    .withMethodReturnType(returnType)
    .withContainingClass(innerClass)
    .withNavigationElement(psiVariable)
    .withModifier(PsiModifier.PUBLIC);

  addAllMethodParameter(allAddMethod, psiFieldType, fieldName);
  allAddMethod.withBody(createAllAddMethodCodeBlock(innerClass, fluentBuilder, fieldName, psiFieldType));
  methods.add(allAddMethod);

  final LombokLightMethodBuilder clearMethod = new LombokLightMethodBuilder(psiManager, "clear" + StringUtil.capitalize(fieldName))
    .withMethodReturnType(returnType)
    .withContainingClass(innerClass)
    .withNavigationElement(psiVariable)
    .withModifier(PsiModifier.PUBLIC)
    .withBody(createClearMethodCodeBlock(innerClass, fluentBuilder, fieldName));

  methods.add(clearMethod);
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:35,代码来源:AbstractSingularHandler.java

示例4: appendBuildPrepare

import com.intellij.psi.PsiVariable; //导入方法依赖的package包/类
@Override
public void appendBuildPrepare(@NotNull StringBuilder buildMethodCode, @NotNull PsiVariable psiVariable, @NotNull String fieldName) {
  final PsiManager psiManager = psiVariable.getManager();
  final PsiType psiFieldType = psiVariable.getType();
  final PsiType keyType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 0);
  final PsiType valueType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 1);

  final String selectedFormat;
  if (collectionQualifiedName.equals(SingularCollectionClassNames.JAVA_UTIL_SORTED_MAP)) {
    selectedFormat = "java.util.SortedMap<{1}, {2}> {0} = new java.util.TreeMap<{1}, {2}>();\n" +
      "      if (this.{0}$key != null) for (int $i = 0; $i < (this.{0}$key == null ? 0 : this.{0}$key.size()); $i++) {0}.put(this.{0}$key.get($i), this.{0}$value.get($i));\n" +
      "      {0} = java.util.Collections.unmodifiableSortedMap({0});\n";
  } else if (collectionQualifiedName.equals(SingularCollectionClassNames.JAVA_UTIL_NAVIGABLE_MAP)) {
    selectedFormat = "java.util.NavigableMap<{1}, {2}> {0} = new java.util.TreeMap<{1}, {2}>();\n" +
      "      if (this.{0}$key != null) for (int $i = 0; $i < (this.{0}$key == null ? 0 : this.{0}$key.size()); $i++) {0}.put(this.{0}$key.get($i), this.{0}$value.get($i));\n" +
      "      {0} = java.util.Collections.unmodifiableNavigableMap({0});\n";
  } else {
    selectedFormat = "java.util.Map<{1}, {2}> {0};\n" +
      "  switch (this.{0}$key == null ? 0 : this.{0}$key.size()) '{'\n" +
      "    case 0:\n" +
      "      {0} = java.util.Collections.emptyMap();\n" +
      "      break;\n" +
      "    case 1:\n" +
      "      {0} = java.util.Collections.singletonMap(this.{0}$key.get(0), this.{0}$value.get(0));\n" +
      "      break;\n" +
      "    default:\n" +
      "      {0} = new java.util.LinkedHashMap<{1}, {2}>(this.{0}$key.size() < 1073741824 ? 1 + this.{0}$key.size() + (this.{0}$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);\n" +
      "      for (int $i = 0; $i < this.{0}$key.size(); $i++) {0}.put(this.{0}$key.get($i), this.{0}$value.get($i));\n" +
      "      {0} = java.util.Collections.unmodifiableMap({0});\n" +
      "  '}'\n";
  }

  buildMethodCode.append(MessageFormat.format(selectedFormat,
    fieldName, keyType.getCanonicalText(false), valueType.getCanonicalText(false), collectionQualifiedName));
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:36,代码来源:SingularMapHandler.java

示例5: appendBuildPrepare

import com.intellij.psi.PsiVariable; //导入方法依赖的package包/类
@Override
public void appendBuildPrepare(@NotNull StringBuilder buildMethodCode, @NotNull PsiVariable psiVariable, @NotNull String fieldName) {
  final PsiManager psiManager = psiVariable.getManager();
  final PsiType psiFieldType = psiVariable.getType();

  final PsiType elementType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager);
  buildMethodCode.append(MessageFormat.format(
    "{2}<{1}> {0} = " +
      "this.{0} == null ? " +
      "{3}.<{1}>of() : " +
      "this.{0}.build();\n",
    fieldName, elementType.getCanonicalText(false), collectionQualifiedName, typeCollectionQualifiedName));
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:14,代码来源:SingularGuavaCollectionHandler.java

示例6: appendBuildPrepare

import com.intellij.psi.PsiVariable; //导入方法依赖的package包/类
@Override
public void appendBuildPrepare(@NotNull StringBuilder buildMethodCode, @NotNull PsiVariable psiVariable, @NotNull String fieldName) {
  final PsiManager psiManager = psiVariable.getManager();
  final PsiType psiFieldType = psiVariable.getType();

  final PsiType keyType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 0);
  final PsiType valueType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 1);

  buildMethodCode.append(MessageFormat.format(
    "{3}<{1}, {2}> {0} = " +
      "this.{0} == null ? " +
      "{3}.<{1}, {2}>of() : " +
      "this.{0}.build();\n",
    fieldName, keyType.getCanonicalText(false), valueType.getCanonicalText(false), collectionQualifiedName));
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:16,代码来源:SingularGuavaMapHandler.java

示例7: appendBuildPrepare

import com.intellij.psi.PsiVariable; //导入方法依赖的package包/类
@Override
public void appendBuildPrepare(@NotNull StringBuilder buildMethodCode, @NotNull PsiVariable psiVariable, @NotNull String fieldName) {
  final PsiManager psiManager = psiVariable.getManager();
  final PsiType elementType = PsiTypeUtil.extractOneElementType(psiVariable.getType(), psiManager);

  final String selectedFormat;
  if (SingularCollectionClassNames.JAVA_UTIL_NAVIGABLE_SET.equals(collectionQualifiedName)) {
    selectedFormat = "{2}<{1}> {0} = new java.util.TreeSet<{1}>();\n" +
      "if (this.{0} != null) {0}.addAll(this.{0});\n" +
      "{0} = java.util.Collections.unmodifiableNavigableSet({0});\n";
  } else if (SingularCollectionClassNames.JAVA_UTIL_SORTED_SET.equals(collectionQualifiedName)) {
    selectedFormat = "{2}<{1}> {0} = new java.util.TreeSet<{1}>();\n" +
      "if (this.{0} != null) {0}.addAll(this.{0});\n" +
      "{0} = java.util.Collections.unmodifiableSortedSet({0});\n";
  } else if (SingularCollectionClassNames.JAVA_UTIL_SET.equals(collectionQualifiedName)) {
    selectedFormat = "{2}<{1}> {0};\n" +
      "switch (this.{0} == null ? 0 : this.{0}.size()) '{'\n" +
      " case 0: \n" +
      "   {0} = java.util.Collections.emptySet();\n" +
      "   break;\n" +
      " case 1: \n" +
      "   {0} = java.util.Collections.singleton(this.{0}.get(0));\n" +
      "   break;\n" +
      " default: \n" +
      "   {0} = new java.util.LinkedHashSet<{1}>(this.{0}.size() < 1073741824 ? 1 + this.{0}.size() + (this.{0}.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);\n" +
      "   {0}.addAll(this.{0});\n" +
      "   {0} = java.util.Collections.unmodifiableSet({0});\n" +
      "'}'\n";
  } else {
    selectedFormat = "{2}<{1}> {0};\n" +
      "switch (this.{0} == null ? 0 : this.{0}.size()) '{'\n" +
      "case 0: \n" +
      " {0} = java.util.Collections.emptyList();\n" +
      " break;\n" +
      "case 1: \n" +
      " {0} = java.util.Collections.singletonList(this.{0}.get(0));\n" +
      " break;\n" +
      "default: \n" +
      " {0} = java.util.Collections.unmodifiableList(new java.util.ArrayList<{1}>(this.{0}));\n" +
      "'}'\n";
  }

  buildMethodCode.append(MessageFormat.format(selectedFormat,
    fieldName, elementType.getCanonicalText(false), collectionQualifiedName));
}
 
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:46,代码来源:SingularCollectionHandler.java


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