Configuring an editor for various languages using Factory Method Pattern I need to know if my code is a valid implementation of the factory method pattern. Also, if the Configuration and Editor were interfaces would this still be a valid implementation of the Factory Pattern?

public abstract class Configuration {

    protected List&lt;String&gt; keyWords;

    abstract void getTheme();
    abstract String getKeyWords();
}




public abstract class Editor {

    public final void useEditor() {
        Configuration configuration = createConfiguration();
        configuration.getTheme();
        parse(configuration.getKeyWords());
        save();
    }

    //The Factory Method
    public abstract Configuration createConfiguration();

    public abstract void parse(String sourceCode);

    public void save() {
        System.out.println("The file was saved..");
    }
}


    

public class JavaConfiguration extends Configuration {
    public JavaConfiguration() {
        keyWords = new ArrayList&lt;&gt;();
        keyWords.add("class");
        keyWords.add("protected");
    }

    @Override
    void getTheme() {
        System.out.println("Applied Java Theme...");
    }

    @Override
    String getKeyWords() {
        return keyWords.toString();
    }
}




public class PythonConfiguration extends Configuration {

    public PythonConfiguration() {
        keyWords = new ArrayList&lt;&gt;();
        keyWords.add("def");
        keyWords.add("print");
    }

    @Override
    void getTheme() {
        System.out.println("Applied Python Theme...");
    }

    @Override
    String getKeyWords() {
        return keyWords.toString();
    }
}




public class JavaEditor extends Editor {
    @Override
    public Configuration createConfiguration() {
        return new JavaConfiguration();
    }

    @Override
    public void parse(String sourceCode) {
        System.out.println("Parsing Java code...");
    }
}




public class PythonEditor extends Editor {

    @Override
    public Configuration createConfiguration() {
        return new PythonConfiguration();
    }

    @Override
    public void parse(String sourceCode) {
        System.out.println("Parsing python code...");
    }
}




public class App {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String language = sc.next();
        Editor editor = createEditor(language);
        editor.useEditor();
    }

    private static Editor createEditor(String language) {
        switch(language) {
            case "Java":
                return new JavaEditor();
            case "Python":
                return new PythonEditor();
            default:
                return null;
        }
    }
}


Edit: It seems that the Factory Method Pattern is not the appropriate design pattern to use in this case, as suggested by @200_success and @Timothy Truckle. A simple Editor class which receives a Configuration as a parameter should be enough.
I need to know if my code is a valid implementation of the factory method pattern. 


No.

The reason is that the factory cannot be part of the objects to be created. I think you would be surprised to find a factory in the the hedge of your car, wouldn't you?

Generally spoken your approach fails the Separation of Concerns principle.

You have two responsibilities in your code that belong to a factory: 


identifying the requested type.
creating the actual object.


Both should be in a separate factory class.



Also: your "factory" is producing the wrong type of objects because of your misconception of inheritance.

We employ inheritance when the child classes differ in behavior. But your Editor extensions only differ in configuration (as far as your code example is showing...).

So what your (yet to build) factory should do is creating the "language depended"  key word list and pass that into a new instance of the one and only Editor class.