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


Java PropertyUtil.getPropertyNameByGetter方法代码示例

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


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

示例1: generateAcceptedMetaFieldNames

import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
private Set<String> generateAcceptedMetaFieldNames(PsiClass psiClass) {
    Set<String> acceptedMetaFields = Sets.newHashSet();

    for (PsiField field : psiClass.getAllFields()) {
        if (!field.hasModifierProperty(PsiModifier.STATIC)) {
            acceptedMetaFields.add(MetaFieldUtil.generateMetaFieldName(field.getName()));
        }
    }
    for (PsiMethod method : psiClass.getAllMethods()) {
        if (!method.hasModifierProperty(PsiModifier.STATIC) && PropertyUtil.isSimplePropertyGetter(method)) {
            String propertyName = PropertyUtil.getPropertyNameByGetter(method);
            acceptedMetaFields.add(MetaFieldUtil.generateMetaFieldName(propertyName));
        }
    }

    return acceptedMetaFields;
}
 
开发者ID:srichard,项目名称:mfgen,代码行数:18,代码来源:InspectingMetaFields.java

示例2: parseProperties

import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
private void parseProperties(PsiMethod method, JavaElementArrangementEntry entry) {
  String propertyName = null;
  boolean getter = true;
  if (PropertyUtil.isSimplePropertyGetter(method)) {
    entry.addModifier(GETTER);
    propertyName = PropertyUtil.getPropertyNameByGetter(method);
  }
  else if (PropertyUtil.isSimplePropertySetter(method)) {
    entry.addModifier(SETTER);
    propertyName = PropertyUtil.getPropertyNameBySetter(method);
    getter = false;
  }

  if (!myGroupingRules.contains(StdArrangementTokens.Grouping.GETTERS_AND_SETTERS) || propertyName == null) {
    return;
  }

  PsiClass containingClass = method.getContainingClass();
  String className = null;
  if (containingClass != null) {
    className = containingClass.getQualifiedName();
  }
  if (className == null) {
    className = NULL_CONTENT;
  }

  if (getter) {
    myInfo.registerGetter(propertyName, className, entry);
  }
  else {
    myInfo.registerSetter(propertyName, className, entry);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:JavaArrangementVisitor.java

示例3: parseProperties

import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
private void parseProperties(PsiMethod method, JavaElementArrangementEntry entry) {
  if (!myGroupingRules.contains(StdArrangementTokens.Grouping.GETTERS_AND_SETTERS)) {
    return;
  }

  String propertyName = null;
  boolean getter = true;
  if (PropertyUtil.isSimplePropertyGetter(method)) {
    propertyName = PropertyUtil.getPropertyNameByGetter(method);
  }
  else if (PropertyUtil.isSimplePropertySetter(method)) {
    propertyName = PropertyUtil.getPropertyNameBySetter(method);
    getter = false;
  }

  if (propertyName == null) {
    return;
  }

  PsiClass containingClass = method.getContainingClass();
  String className = null;
  if (containingClass != null) {
    className = containingClass.getQualifiedName();
  }
  if (className == null) {
    className = NULL_CONTENT;
  }

  if (getter) {
    myInfo.registerGetter(propertyName, className, entry);
  }
  else {
    myInfo.registerSetter(propertyName, className, entry);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:JavaArrangementVisitor.java

示例4: parseProperties

import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
private void parseProperties(PsiMethod method, JavaElementArrangementEntry entry)
{
	if(!myGroupingRules.contains(StdArrangementTokens.Grouping.GETTERS_AND_SETTERS))
	{
		return;
	}

	String propertyName = null;
	boolean getter = true;
	if(PropertyUtil.isSimplePropertyGetter(method))
	{
		propertyName = PropertyUtil.getPropertyNameByGetter(method);
	}
	else if(PropertyUtil.isSimplePropertySetter(method))
	{
		propertyName = PropertyUtil.getPropertyNameBySetter(method);
		getter = false;
	}

	if(propertyName == null)
	{
		return;
	}

	PsiClass containingClass = method.getContainingClass();
	String className = null;
	if(containingClass != null)
	{
		className = containingClass.getQualifiedName();
	}
	if(className == null)
	{
		className = NULL_CONTENT;
	}

	if(getter)
	{
		myInfo.registerGetter(propertyName, className, entry);
	}
	else
	{
		myInfo.registerSetter(propertyName, className, entry);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:45,代码来源:JavaArrangementVisitor.java

示例5: getGetterFieldName

import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
/**
 * Gets the field name of the getter method.
 * <p/>
 * The method must be a getter method for a field.
 * Returns null if this method is not a getter.
 * <p/>
 * The fieldname is the part of the name that is after the <code>get</code> or <code>is</code> part
 * of the name.
 * <p/>
 * Example: methodName=getName will return fieldname=name
 *
 *
 * @param method  the method
 * @return the fieldname if this is a getter method.
 * @see #isGetterMethod(com.intellij.psi.PsiMethod) for the getter check
 */
@Nullable
public static String getGetterFieldName(PsiMethod method) {
    // must be a getter
    if (!isGetterMethod(method)) {
        return null;
    }
    return PropertyUtil.getPropertyNameByGetter(method);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PsiAdapter.java

示例6: getGetterFieldName

import com.intellij.psi.util.PropertyUtil; //导入方法依赖的package包/类
/**
 * Gets the field name of the getter method.
 * <p/>
 * The method must be a getter method for a field.
 * Returns null if this method is not a getter.
 * <p/>
 * The fieldname is the part of the name that is after the <code>get</code> or <code>is</code> part
 * of the name.
 * <p/>
 * Example: methodName=getName will return fieldname=name
 *
 * @param method the method
 * @return the fieldname if this is a getter method.
 * @see #isGetterMethod(com.intellij.psi.PsiMethod) for the getter check
 */
@Nullable
public static String getGetterFieldName(PsiMethod method)
{
	// must be a getter
	if(!isGetterMethod(method))
	{
		return null;
	}
	return PropertyUtil.getPropertyNameByGetter(method);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:PsiAdapter.java


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