Package com.github.dandelion.datatables.core.processor.css

Source Code of com.github.dandelion.datatables.core.processor.css.CssThemeProcessor

package com.github.dandelion.datatables.core.processor.css;

import com.github.dandelion.core.utils.EnumUtils;
import com.github.dandelion.core.utils.StringUtils;
import com.github.dandelion.datatables.core.exception.ConfigurationProcessingException;
import com.github.dandelion.datatables.core.extension.Extension;
import com.github.dandelion.datatables.core.extension.theme.Theme;
import com.github.dandelion.datatables.core.processor.AbstractConfigurationProcessor;

public class CssThemeProcessor extends AbstractConfigurationProcessor {

  @Override
  public void doProcess() {

    if (StringUtils.isNotBlank(stringifiedValue)) {

      Extension theme = null;

      try {
        theme = Theme.valueOf(stringifiedValue.toUpperCase()).getInstance();
      } catch (IllegalArgumentException e) {
        StringBuilder sb = new StringBuilder();
        sb.append("'");
        sb.append(stringifiedValue);
        sb.append("' is not a valid theme name. Possible values are: ");
        sb.append(EnumUtils.printPossibleValuesOf(Theme.class));
        throw new ConfigurationProcessingException(sb.toString());
      }

      updateEntry(theme);
    }
  }
}
TOP

Related Classes of com.github.dandelion.datatables.core.processor.css.CssThemeProcessor

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.