Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.transformer
Class TransformerWeighting

    java.lang.Object
      org.mule.transformer.TransformerWeighting

All Implemented Interfaces:
  Comparable

    public class TransformerWeighting

extends Object
implements Comparable

Given a `Transformer` instance, an input class and output class this object will create a weighting for a transformer. This weighthing can be used compare one transformer with another, which can be useful for choosing a transformer to use given the input class and required output class.

Constructor Summary
`TransformerWeighting(Class inputClass, Class outputClass, Transformer transformer)`

Method Summary
`int` | `compareTo(Object o)`
`boolean` | `equals(Object o)`
`Class` | `getInputClass()`
`int` | `getInputWeighting()`
`Class` | `getOutputClass()`
`int` | `getOutputWeighting()`
`Transformer` | `getTransformer()`
`protected int` | `getWeighting(int weighting, Class src, Class dest)` THis is a very basic algorithm for creating a match rating for two classes.
`int` | `hashCode()`
`boolean` | `isExactMatch()`
`boolean` | `isNotMatch()`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TransformerWeighting

    public TransformerWeighting(Class inputClass,
                                Class outputClass,
                                Transformer transformer)

Method Detail

### getWeighting

    protected int getWeighting(int weighting,
                               Class src,
                               Class dest)

  THis is a very basic algorithm for creating a match rating for two classes. An offset weighting can also be passed in. Where w is weighting, if the classes match exactly, w+1 is returned, if the classes are assignable and there is a direct equality to an interface on the class, w+2 is returned, if the classes are assignable but no direct interface match, w+3 is returned If the dest type is Object.class then w+4is returned. This is because matching on object will yeild a lot of options putting those that use the Object.class generic type should get pushed down the list If there a super class, that will get matched using the above criteria If there is no match -1 is returned

  Parameters:
    `weighting` - an offset weighting, by defualt -1 should be used
    `src` - the src class being matched
    `dest` - the destination class to match to
  Returns:
    a weighting where 0 would be an exact match, -1 would be no match and a positive integer that defines how close the match is

### getInputClass

    public Class getInputClass()

### getInputWeighting

    public int getInputWeighting()

### getOutputClass

    public Class getOutputClass()

### getOutputWeighting

    public int getOutputWeighting()

### getTransformer

    public Transformer getTransformer()

### isExactMatch

    public boolean isExactMatch()

### isNotMatch

    public boolean isNotMatch()

### compareTo

    public int compareTo(Object o)

  Specified by:
    `compareTo` in interface `Comparable`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.