GrMethod (PsiClass aClass, FileTemplate template) { Properties properties = FileTemplateManager.getInstance(aClass.getProject()).getDefaultProperties(); properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, "void"); properties.setProperty(FileTemplate.ATTRIBUTE_DEFAULT_RETURN_VALUE, ""); properties.setProperty(FileTemplate.ATTRIBUTE_CALL_SUPER, ""); properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, aClass.getQualifiedName()); properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, aClass.getName()); properties.setProperty(FileTemplate.ATTRIBUTE_METHOD_NAME, "propertyMissing"); String bodyText; try { bodyText = StringUtil.replace(template.getText(properties), ";", ""); } catch (IOException e) { return null; } return GroovyPsiElementFactory.getInstance(aClass.getProject()) .createMethodFromText("def propertyMissing(String name, def arg) {\n" + bodyText + "\n}"); }