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

pl.allegro.tech.hermes.management.infrastructure.query.graph.JXPathAttribute Maven / Gradle / Ivy

package pl.allegro.tech.hermes.management.infrastructure.query.graph;

import org.apache.commons.jxpath.FunctionLibrary;
import org.apache.commons.jxpath.JXPathContext;

public class JXPathAttribute implements ObjectAttribute {

  private final Object target;

  private final String path;

  public JXPathAttribute(Object target, String path) {
    this.target = target;
    this.path = path.replace('.', '/');
  }

  @Override
  public Object value() {
    JXPathContext context = JXPathContext.newContext(target);
    context.setFunctions(new FunctionLibrary());
    return context.getValue(path);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy