Build message by message body converter.

@param converter
@return
@since 1.4.5
181282
public <T> Message build(MessageBodyConverter<T> converter) {
        if (StringUtils.isBlank(this.topic)) {
            throw new IllegalArgumentException("Blank topic");
        }
        if (this.body == null && this.payload == null) {
            throw new IllegalArgumentException("Empty payload");
        }
        byte[] payload = this.payload;
        if (payload == null && converter != null) {
            try {
                payload = converter.toByteArray((T) this.body);
            }
            catch (MetaClientException e) {
                throw new IllegalStateException("Convert message body failed.", e);
            }
        }

        if (payload == null) {
            throw new IllegalArgumentException("Empty payload");
        }
        return new Message(this.topic, payload, this.attribute);
    }
1047840
private static final HttpMessageConverter<?> getHalConverter(List<MediaType> halFlavours) {

		ObjectMapper mapper = new ObjectMapper();
		mapper.registerModule(new Jackson2HalModule());
		mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

		MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();

		converter.setObjectMapper(mapper);
		converter.setSupportedMediaTypes(halFlavours);

		return converter;
	}
1121570
public static <U, V> Converter<V, U> wrapWithCast(
      Converter<Object, U> converter, Class<V> type) {
    Converter<V, Object> castConverter = new CastingConverter<V>(type).inverse();
    return castConverter.compose(converter);
  }
987395
@Override
  public ConvertManager converter()
  {
    if (_convertManager == null) {
      _convertManager = provider(Key.of(ConvertManager.class));
    }

    return _convertManager.get();
  }
479190
public Converter<NetworkResponse, ?> getResponseConverter(Type type, Annotation[] annotations) {
        checkNotNull(type, "type == null");
        checkNotNull(annotations, "annotations == null");

        for (int i = 0, count = converterFactories.size(); i < count; i++) {
            Converter<NetworkResponse, ?> converter =
                    converterFactories.get(i).fromResponse(type, annotations);
            if (converter != null) {
                return converter;
            }
        }

        StringBuilder builder = new StringBuilder("Could not locate Response converter for ")
                .append(type)
                .append(". Tried:");
        for (Factory converterFactory : converterFactories) {
            builder.append("\n * ").append(converterFactory.getClass().getName());
        }
        throw new IllegalArgumentException(builder.toString());
    }
152204
public void addConverterComponent(ValueConverter<?, ?> converter) {

    if (converter instanceof AbstractRecursiveValueConverter) {
      ((AbstractRecursiveValueConverter<?, ?>) converter).setComposedValueConverter(this);
    }
    if (converter instanceof AbstractComponent) {
      ((AbstractComponent) converter).initialize();
    }
    addConverter(converter);
  }
1273225
protected Converter createConverter(FaceletContext ctx)
    {
        if (_delegate.getConverterId(ctx) == null)
        {
            throw new TagException(_delegate.getTag(),
                                    "Default behavior invoked of requiring a converter-id passed in the "
                                    + "constructor, must override ConvertHandler(ConverterConfig)");
        }
        return ctx.getFacesContext().getApplication().createConverter(_delegate.getConverterId(ctx));
    }
1327413
public TreeBuilder<T> convert(ContentConverter<T> converter, Path subpath,
            ResourceSelector<T> resourceSelector) {
        return convert(converter, PathUtil.subpathSelector(subpath), resourceSelector);
    }
272689
public BaseConvertToNative getConvertToNative()
    {
        if (m_convertToNative == null)
        {
            BaseMessageHeader trxMessageHeader = this.getMessage().getMessageHeader();
            String strMessageClass = (String)trxMessageHeader.get(TrxMessageHeader.MESSAGE_MARSHALLER_CLASS);
            String strPackage = (String)trxMessageHeader.get(TrxMessageHeader.BASE_PACKAGE);
            strMessageClass = ClassServiceUtility.getFullClassName(strPackage, strMessageClass);
            m_convertToNative = (BaseConvertToNative)ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageClass);
            if (m_convertToNative != null)
            	m_convertToNative.init(this);
        }
        return m_convertToNative;
    }
158700
public static <E> void registerTypeConverter(Class<E> cls, TypeConverter<E> converter) {
        TYPE_CONVERTERS.put(cls, converter);
    }
827570
public static <U, V> Converter<U, V> wrapSingletonList(Converter<List<U>, V> converter) {
    Converter<U, List<U>> listConverter = new SingletonListConverter<U>().inverse();
    return listConverter.compose(converter);
  }
1225815
@Trivial
    public static <K> UserConverter<K> newInstance(Converter<K> converter) {
        return newInstance(getType(converter), converter);
    }
1232241
static List<RequestObjectResolver> toRequestObjectResolvers(
            List<RequestConverterFunction> converters) {
        final ImmutableList.Builder<RequestObjectResolver> builder = ImmutableList.builder();
        // Wrap every converters received from a user with a default object resolver.
        converters.stream().map(RequestObjectResolver::of).forEach(builder::add);
        builder.addAll(defaultRequestConverters);
        return builder.build();
    }
968074
public TreeBuilder<T> convert(ContentConverter<T> converter, PathSelector selector) {
        return TreeBuilder.<T>builder(new ConverterTree<T>(build(), converter, selector));
    }
226102
public void addConverterToPass(Converter converter)
    {
        if (m_vconvDependent == null)
            m_vconvDependent = new Vector<Converter>();
        m_vconvDependent.add(converter);
        this.setEnableTranslation(false);
        if ((this.getNextConverter() == null)
            || (this.getNextConverter().getField() == null))
        {
        this.setEnableTranslation(true);
            return;
        }
        for (int iSeq = 0; ; iSeq++)
        {
            ScreenComponent sField = (ScreenComponent)this.getNextConverter().getField().getComponent(iSeq);
            if (sField == null)
                break;
            if (!this.isConverterInPath(sField))
                continue;  // This converter does not belong to this screen field
            if (converter != null)
                if (converter.getField() != null)
            {
                boolean bFound = false;
                for (int iSeq2 = 0; ; iSeq2++)
                {
                    if (converter.getField().getComponent(iSeq2) == null)
                        break;
                    if (converter.getField().getComponent(iSeq2) == sField)
                        bFound = true;
                }
                if (!bFound)
                    converter.addComponent(sField);
            }
        }
        this.setEnableTranslation(true);
    }
221589
public JodaBeanSer withConverter(StringConvert converter) {
        JodaBeanUtils.notNull(converter, "converter");
        return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived);
    }
831914
private static Converter<List<String>, Object> createStringConstructorConverter(Class<?> resultClass) {
    try {
      final Constructor<?> constructor = resultClass.getConstructor(String.class);
      return new BasicConverter(defaultValue(resultClass)) {
        @Override
        protected Object convert(String value) throws Exception {
          return constructor.newInstance(value);
        }
      };
    } catch (Exception e) {
      return null;
    }
  }