All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mvel2.conversion.CompositeCH Maven / Gradle / Ivy

Go to download

TBEL is a powerful expression language for ThingsBoard platform user-defined functions. Original implementation is based on MVEL.

There is a newer version: 1.2.4
Show newest version
package org.mvel2.conversion;

import org.mvel2.ConversionHandler;

public class CompositeCH implements ConversionHandler {

  private final ConversionHandler[] converters;

  public CompositeCH(ConversionHandler... converters) {
    this.converters = converters;
  }

  public Object convertFrom(Object in) {
    for (ConversionHandler converter : converters) {
      if (converter.canConvertFrom(in.getClass())) return converter.convertFrom(in);
    }
    return null;
  }

  public boolean canConvertFrom(Class cls) {
    for (ConversionHandler converter : converters) {
      if (converter.canConvertFrom(cls)) return true;
    }
    return false;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy