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.simple
Class StringToNumber

    java.lang.Object
      org.mule.transformer.AbstractTransformer
          org.mule.transformer.simple.StringToNumber

All Implemented Interfaces:
  MuleContextAware, MuleContextNotificationListener<MuleContextNotification>, ServerNotificationListener<MuleContextNotification>, Disposable, Initialisable, NamedObject, MessageProcessor, DiscoverableTransformer, Transformer, EndpointAware

    public class StringToNumber

extends AbstractTransformer
implements DiscoverableTransformer

`StringToNumber` converts a String to a Number. A NumberFormat is used if one is provided.

Field Summary

Fields inherited from class org.mule.transformer.AbstractTransformer
`encoding, endpoint, logger, mimeType, MULE_MESSAGE_DATA_TYPE, muleContext, name, returnType, sourceTypes`

Fields inherited from interface org.mule.api.transformer.DiscoverableTransformer
`DEFAULT_PRIORITY_WEIGHTING, MAX_PRIORITY_WEIGHTING, MIN_PRIORITY_WEIGHTING`

Fields inherited from interface org.mule.api.lifecycle.Initialisable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`StringToNumber()`
`StringToNumber(NumberFormat numberFormat)`

Method Summary
`Object` | `doTransform(Object src, String encoding)`
`int` | `getPriorityWeighting()` If 2 or more discoverable transformers are equal, this value can be used to select the correct one
`Class<? extends Number>` | `getReturnClass()` Specifies the Java type of the result after this transformer has been executed.
`void` | `setPriorityWeighting(int priorityWeighting)` If 2 or more discoverable transformers are equal, this value can be used to select the correct one
`void` | `setReturnDataType(DataType<?> type)` Sets the expected return type for the transformed data.

Methods inherited from class org.mule.transformer.AbstractTransformer
`checkReturnClass, dispose, generateTransformerName, getEncoding, getEncoding, getEndpoint, getMimeType, getName, getReturnDataType, getSourceDataTypes, getSourceTypes, initialise, isAcceptNull, isAllowNullReturn, isConsumed, isIgnoreBadInput, isSourceDataTypeSupported, isSourceDataTypeSupported, isSourceTypeSupported, isSourceTypeSupported, onNotification, process, registerSourceType, registerSourceType, setAllowNullReturn, setEncoding, setEndpoint, setIgnoreBadInput, setMimeType, setMuleContext, setName, setReturnClass, toString, transform, transform, unregisterSourceType, unregisterSourceType`

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

Constructor Detail

### StringToNumber

    public StringToNumber()

### StringToNumber

    public StringToNumber(NumberFormat numberFormat)

Method Detail

### doTransform

    public Object doTransform(Object src,
                              String encoding)
                       throws TransformerException

  Specified by:
    `doTransform` in class `AbstractTransformer`
  Throws:
    `TransformerException`

### getReturnClass

    public Class<? extends Number> getReturnClass()

  Description copied from interface: `Transformer`
  Specifies the Java type of the result after this transformer has been executed. Mule will use this to validate the return type but also allow users to perform automatic transformations based on the source type of the object to transform and this return type.

  Specified by:
    `getReturnClass` in interface `Transformer`
  Overrides:
    `getReturnClass` in class `AbstractTransformer`
  Returns:
    the excepted return type from this transformer

### setReturnDataType

    public void setReturnDataType(DataType<?> type)

  Description copied from interface: `Transformer`
  Sets the expected return type for the transformed data. If the transformed data is not of this class type a `TransformerException` will be thrown.

  This method superseeds `Transformer.getReturnClass()` because it allows Generics information to be associated with the return type of the transformer

  Specified by:
    `setReturnDataType` in interface `Transformer`
  Overrides:
    `setReturnDataType` in class `AbstractTransformer`
  Parameters:
    `type` - the expected return type for this transformer

### getPriorityWeighting

    public int getPriorityWeighting()

  Description copied from interface: `DiscoverableTransformer`
  If 2 or more discoverable transformers are equal, this value can be used to select the correct one

  Specified by:
    `getPriorityWeighting` in interface `DiscoverableTransformer`
  Returns:
    the priority weighting for this transformer. This is a value between `DiscoverableTransformer.MIN_PRIORITY_WEIGHTING` and `DiscoverableTransformer.MAX_PRIORITY_WEIGHTING`.

### setPriorityWeighting

    public void setPriorityWeighting(int priorityWeighting)

  Description copied from interface: `DiscoverableTransformer`
  If 2 or more discoverable transformers are equal, this value can be used to select the correct one

  Specified by:
    `setPriorityWeighting` in interface `DiscoverableTransformer`
  Parameters:
    `priorityWeighting` - the priority weighting for this transformer. This is a value between `DiscoverableTransformer.MIN_PRIORITY_WEIGHTING` and `DiscoverableTransformer.MAX_PRIORITY_WEIGHTING`.

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.