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


Java PsiCodeBlock.add方法代码示例

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


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

示例1: readMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
    public void readMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
        if (null == methodBody) {
            return;
        }

        String fieldName = field.getName();
        String parameterType = ((PsiClassReferenceType) field.getType()).getParameters()[0].getPresentableText();

//        // phones = new ArrayList<>();
//        // in.readTypedList(phones, Phone.CREATOR);
//        methodBody.add(factory.createStatementFromText(fieldName + " = new ArrayList<" + parameterType + ">();", null));
//        methodBody.add(factory.createStatementFromText("in.readTypedList(" + fieldName + ", " + parameterType + ".CREATOR);", null));

        // phones = in.createTypedArrayList(Phone.CREATOR);
        methodBody.add(factory.createStatementFromText(fieldName + " = in.createTypedArrayList(" + parameterType + ".CREATOR);", null));


    }
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:20,代码来源:ParcelableListGenerator.java

示例2: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    methodBody.add(factory.createStatementFromText("out.writeValue(" + field.getName() + ");", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:8,代码来源:PrimitiveWrapperTypeGenerator.java

示例3: readMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void readMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    methodBody.add(factory.createStatementFromText(field.getName() + " = (" + typeNameHolder + ")in.readValue(" + typeNameHolder + ".class.getClassLoader());", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:8,代码来源:PrimitiveWrapperTypeGenerator.java

示例4: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    String typeNameHolder = field.getType().getDeepComponentType().getPresentableText();
    String temp = typeNameHolder.substring(0, 1).toUpperCase() + typeNameHolder.substring(1);
    methodBody.add(factory.createStatementFromText("out.write" + temp + "Array(" + field.getName() + ");", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:10,代码来源:PrimitiveArrayGenerator.java

示例5: readMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
    public void readMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
        if (null == methodBody) {
            return;
        }
        String fieldName = field.getName();
        String typeNameHolder = field.getType().getDeepComponentType().getPresentableText();
        String temp = typeNameHolder.substring(0, 1).toUpperCase() + typeNameHolder.substring(1);
//        methodBody.add(factory.createStatementFromText(fieldName + " = new " + typeNameHolder + "[in.readInt()];", null));
//        methodBody.add(factory.createStatementFromText("in.read" + temp + "Array(" + fieldName + ");", null));

        // nickNames = in.createStringArray();
        methodBody.add(factory.createStatementFromText(fieldName + " = in.create" + temp + "Array();", null));

    }
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:16,代码来源:PrimitiveArrayGenerator.java

示例6: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    methodBody.add(factory.createStatementFromText("out.writeByte((byte) (" + field.getName() + " ? 1 : 0));", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:8,代码来源:PrimitiveBooleanGenerator.java

示例7: readMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void readMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    methodBody.add(factory.createStatementFromText(field.getName() + " = 1 == in.readByte();", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:8,代码来源:PrimitiveBooleanGenerator.java

示例8: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    String typeNameHolder = field.getType().getPresentableText();
    String temp = typeNameHolder.substring(0, 1).toUpperCase() + typeNameHolder.substring(1);
    methodBody.add(factory.createStatementFromText("out.write" + temp + "(" + field.getName() + ");", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:10,代码来源:PrimitiveTypeGenerator.java

示例9: readMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void readMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    String typeNameHolder = field.getType().getPresentableText();
    String temp = typeNameHolder.substring(0, 1).toUpperCase() + typeNameHolder.substring(1);
    methodBody.add(factory.createStatementFromText(field.getName() + " = in.read" + temp + "();", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:10,代码来源:PrimitiveTypeGenerator.java

示例10: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    // out.writeParcelableArray(phoneArray, 0);
    methodBody.add(factory.createStatementFromText("out.writeTypedArray(" + field.getName() + ", 0);", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:9,代码来源:ParcelableArrayGenerator.java

示例11: readMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void readMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }

    String fieldName = field.getName();
    String deepComponentType = field.getType().getDeepComponentType().getPresentableText();

    // phoneArray = in.createTypedArray(Phone.CREATOR);
    methodBody.add(factory.createStatementFromText(fieldName + " = in.createTypedArray(" + deepComponentType + ".CREATOR);", null));


}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:15,代码来源:ParcelableArrayGenerator.java

示例12: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    // out.writeTypedList(p);
    methodBody.add(factory.createStatementFromText("out.writeTypedList(" + field.getName() + ");", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:9,代码来源:ParcelableListGenerator.java

示例13: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    // out.writeParcelable(p, 0);
    methodBody.add(factory.createStatementFromText("out.writeParcelable(" + field.getName() + ", 0);", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:9,代码来源:ParcelableTypeGenerator.java

示例14: readMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void readMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }

    // p = in.readParcelable(getClass().getClassLoader())
    methodBody.add(factory.createStatementFromText(field.getName() + " = in.readParcelable(" + field.getType().getPresentableText() + ".class.getClassLoader());", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:10,代码来源:ParcelableTypeGenerator.java

示例15: writeMethod

import com.intellij.psi.PsiCodeBlock; //导入方法依赖的package包/类
@Override
public void writeMethod(PsiCodeBlock methodBody, PsiElementFactory factory, PsiField field) {
    if (null == methodBody) {
        return;
    }
    // out.writeSerializable();
    methodBody.add(factory.createStatementFromText("out.writeSerializable(" + field.getName() + ");", null));
}
 
开发者ID:wangjiegulu,项目名称:AndroidParcelablePlugin,代码行数:9,代码来源:SerializableTypeGenerator.java


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