本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}