Package com.dubture.composer.ui.converter

Source Code of com.dubture.composer.ui.converter.Keywords2StringConverter

package com.dubture.composer.ui.converter;

import org.apache.commons.lang.StringUtils;
import org.eclipse.core.databinding.conversion.Converter;

import com.dubture.getcomposer.core.collection.JsonArray;

public class Keywords2StringConverter extends Converter {

  public Keywords2StringConverter() {
    super(JsonArray.class, String.class);
  }

  @Override
  public String convert(Object fromObject) {
    if (fromObject == null) {
      return "";
    }
    JsonArray keywords = (JsonArray)fromObject;
    return StringUtils.join((String[])keywords.toArray(new String[]{}), ", ");
  }

}
TOP

Related Classes of com.dubture.composer.ui.converter.Keywords2StringConverter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.