polymorphism, inheritances and interfaces in java, script parser