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

com.bpodgursky.jbool_expressions.parsers.QuotedMapper Maven / Gradle / Ivy

There is a newer version: 8.1.2
Show newest version
package com.bpodgursky.jbool_expressions.parsers;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public abstract class QuotedMapper implements TokenMapper {

  private static final Pattern QUOTED = Pattern.compile("\"([^\"])+\"");

  @Override
  public T getVariable(String name) {
    Matcher m = QUOTED.matcher(name);
    if(m.matches()){
      return getValue(m.group(1));
    }else{
      throw new RuntimeException("Invalid variable name: "+name);
    }
  }

  public abstract T getValue(String name);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy