Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 3.1.2
  • Component/s: Examples / Tutorials
  • Labels:
    None
  • User impact:
    Low
  • Affects Docs:
    Yes
  • Similar Issues:
    None

Description

Documentation in :

http://www.mulesoft.org/documentation/display/MULE3USER/Creating+Custom+Transformer+Class

Is suggesting to use :

this.registerSourceType(String.class);
this.setReturnClass(NameString.class);

But as in AbstractTransformer.java :

/**

  • Register a supported data type with this transformer. The will allow objects that match this data type to be
  • transformed by this transformer.
    *
  • @param aClass the source type to allow
  • @deprecated use registerSourceType(DataType)
    */
    @Deprecated
    protected void registerSourceType(Class<?> aClass) { registerSourceType(new SimpleDataType<Object>(aClass)); }

@Deprecated
public void setReturnClass(Class<?> newClass)

{ DataType<?> tempReturnType = new SimpleDataType<Object>(newClass); tempReturnType.setMimeType(mimeType); tempReturnType.setEncoding(encoding); setReturnDataType(tempReturnType); }

So probably :

registerSourceType(DataTypeFactory.OBJECT);
setReturnDataType(DataTypeFactory.create(NameString.class));

Should have been used instead. Also It uses "NameString" which is not imported at the beginning of the example.

Activity

Hide
Dirk Olmes added a comment -

Updated all references to deprecated API with valid ones.

Show
Dirk Olmes added a comment - Updated all references to deprecated API with valid ones.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: