public ManLightMethodBuilderImpl( PsiManager manager, String name ) { super( manager, JavaLanguage.INSTANCE, name, new LightParameterListBuilder( manager, JavaLanguage.INSTANCE ), new ManLightModifierListImpl( manager, JavaLanguage.INSTANCE ) ); _nameIdentifier = new LightIdentifier( manager, name ); }
public GrAccessorMethodImpl(@NotNull GrField property, boolean isSetter, String name) { super(property.getManager(), GroovyLanguage.INSTANCE, name, new LightParameterListBuilder(property.getManager(), GroovyLanguage.INSTANCE), new LightModifierList(property.getManager()) { @Override public String getText() { final String[] modifiers = getModifiers(); if (modifiers.length == 0) return ""; if (modifiers.length == 1) return modifiers[0]; return StringUtil.join(modifiers, " "); } }); myProperty = property; myIsSetter = isSetter; if (myIsSetter) { PsiType type = myProperty.getDeclaredType(); if (type == null) { type = TypesUtil.getJavaLangObject(myProperty); } addParameter(myProperty.getName(), type); } setMethodReturnType(myIsSetter ? PsiType.VOID : myProperty.getType()); addModifier(PsiModifier.PUBLIC); if (myProperty.hasModifierProperty(PsiModifier.STATIC)) { addModifier(PsiModifier.STATIC); } else if (myProperty.hasModifierProperty(PsiModifier.FINAL)) { //don't add final modifier to static method addModifier(PsiModifier.FINAL); } if (GrTraitUtil.isTrait(property.getContainingClass())) { addModifier(PsiModifier.ABSTRACT); } setNavigationElement(property); setBaseIcon(JetgroovyIcons.Groovy.Property); setContainingClass(myProperty.getContainingClass()); setMethodKind("AccessorMethod"); setOriginInfo("synthetic accessor for '"+myProperty.getName()+"'"); }
public GrAccessorMethodImpl(@NotNull GrField property, boolean isSetter, String name) { super(property.getManager(), GroovyFileType.GROOVY_LANGUAGE, name, new LightParameterListBuilder(property.getManager(), GroovyFileType.GROOVY_LANGUAGE), new LightModifierList(property.getManager()) { @Override public String getText() { final String[] modifiers = getModifiers(); if (modifiers.length == 0) return ""; if (modifiers.length == 1) return modifiers[0]; return StringUtil.join(modifiers, " "); } }); myProperty = property; myIsSetter = isSetter; if (myIsSetter) { PsiType type = myProperty.getDeclaredType(); if (type == null) { type = TypesUtil.getJavaLangObject(myProperty); } addParameter(myProperty.getName(), type); } setMethodReturnType(myIsSetter ? PsiType.VOID : myProperty.getType()); addModifier(PsiModifier.PUBLIC); if (myProperty.hasModifierProperty(PsiModifier.STATIC)) { addModifier(PsiModifier.STATIC); } else if (myProperty.hasModifierProperty(PsiModifier.FINAL)) { //don't add final modifier to static method addModifier(PsiModifier.FINAL); } setNavigationElement(property); setBaseIcon(JetgroovyIcons.Groovy.Property); setContainingClass(myProperty.getContainingClass()); setMethodKind("AccessorMethod"); setOriginInfo("synthetic accessor for '"+myProperty.getName()+"'"); }
@NotNull @Override public PsiParameterList getParameterList() { return new LightParameterListBuilder(PsiManager.getInstance(getProject()), getLanguage()); }