Java MultiMethod Framework
Goal Informations

In Java, method resolution is performed at runtime, by late binding, with respect to the dynamic type of the target object. Some object-oriented langages such as CLOS propose, in addition, late-binding according to dynamic types of all arguments. This feature is know as multi-polymorphism and usally achived by multi-methods.
The Java MultiMethod Framework is a pure Java framework that provides multi-methods without extending the base Java language nor modifying its semantics but intensively using the reflection mechanism of the language.

  1. goal
  2. architecture
    1. multi-methods
    2. pattern matcher
    3. adapter factory
  3. examples
  4. docs
  5. download
  6. paper & slides

The Java MultiMethod Framework is based on three sub-packages :

The MultiMethod core API (package fr.umlv.jmmf.reflect)
This package contains the class MultiMethod that implements the multi-polymorphism mecanism.

The PatternMatcher API (package fr.umlv.jmmf.matcher)
This package contains the class PatternMatcher. Inherit from the PatternMatcher class is a simple way to use multi-polymorphism.

The AdapterFactory API (package fr.umlv.jmmf.adapter)
This package contains the class AdapterFactory. This factory create a specialized classes for adapting type to another. This class use multi-methods to specified implementation methods of the generated adapter.


The example below explicit a simple use of the class MultiMethod.

import fr.umlv.jmmf.reflect.*;

public class Example {
  static public String toString(Integer i) {
    return Integer.toHexString(i.intValue());
  static public String toString(Object o) {
    return o.toString();

  public static void main(String[] args)
    throws Throwable {

    MultiMethod mm=MultiMethod.create(Example.class,"toString",1);

    Object o1="hello multi-method";
    Object o2=new Integer(3);

    System.out.println(mm.invoke(null,new Object[]{o1}));
    System.out.println(mm.invoke(null,new Object[]{o2}));

Others examples can be found here !.


The documentation of the latest version in available online.

  1. browse the documentation online.
  2. a FAQ (in french).


The latest JMMF version is v0.8.10, documentation and jar file are available separately :
Java MultiMethod Framework v0.8.10 Classes (117 ko)
Java MultiMethod Framework v0.8.8 Docs (216 ko)
Olders versions are available here.
PS: a vicious bug in netscape 4.7 can't permit to download '.jar' file. To workaround this bug the jar file (jmmf.jar) that contains all classes is renamed to

Sources are availables at :

Papers & Slides

Because the JMMF package is a part of my PhD Thesis, The following entries are some research papers and slides.

IGM report 2001-02
A Simple Dispatch Technique for Pure Java Multi-Methods,
Rémi Forax, Etienne Duris and Gilles Roussel Report IGM 2001-02
Postscript A Simple Dispatch Technique for Pure Java Multi-Methods
Slides Available soon.
TOOLS Pacific'00
The Java MultiMethod Framework,
Rémi Forax, Etienne Duris and Gilles Roussel In TOOLS Pacific'00 Procedings, Sydney, Austalia, November 2000, IEEE computer.
Postscript The Java MultiMethod Framework
Slides The Java MultiMethod Framework
The Java MultiMethod Framework (french)
Seminary in March 2000
Adapter & Cie,
Rémi Forax
Slides Adapter and Cie (in french)
Pattern Matching in Java,
Rémi Forax and Gilles Roussel At the First International Symposium on Generative and Component-Based Software Engineering, GCSE'99 procedings, number 1799 in LNCS, Erfurt, Germany, September 1999.
Postscript Pattern Matching in Java
Slides Recursive Types and Pattern Matching in Java.

Rémi Forax 2001 Université de Marne la Vallée