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

com.iodesystems.xml.tools.loaded.FileLoaded Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
package com.iodesystems.xml.tools.loaded;

import com.iodesystems.xml.tools.Locator;
import com.iodesystems.xml.tools.XmlLoader;
import javax.xml.stream.Location;

public class FileLoaded implements Loaded {
  private final String fileSource;
  private final T value;
  private final Locator locator;
  private final XmlLoader xmlLoader;

  public FileLoaded(String fileSource, T value, Locator locator, XmlLoader xmlLoader) {
    this.fileSource = fileSource;
    this.value = value;
    this.locator = locator;
    this.xmlLoader = xmlLoader;
  }

  @Override
  public T getValue() {
    return value;
  }

  @Override
  public Location getLocation(Object o) {
    return locator.getLocation(o);
  }

  @SuppressWarnings("unchecked")
  public Loaded reload() throws FileLoadErrored, NodeLoadErrored {
    return xmlLoader.load((Class) value.getClass(), fileSource);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy