i having conceptual difficulties types configuration , propertiesconfiguration apache commons configuration.
propertiesconfiguration config = createconfig(); blazegraphembedded graph = blazegraphembedded.open(repo, config);
createconfig() method:
public static propertiesconfiguration createconfig() { propertiesconfiguration config = null; parameters params = new parameters(); basicconfigurationbuilder<propertiesconfiguration> builder = new basicconfigurationbuilder<propertiesconfiguration>(propertiesconfiguration.class) .configure(params.basic() .setlistdelimiterhandler(new defaultlistdelimiterhandler(',')) .setthrowexceptiononmissing(true)); try { config = builder.getconfiguration(); config.addproperty("value_factory", bvf_extendo4000.instance); } catch (configurationexception e) { // todo auto-generated catch block e.printstacktrace(); } system.out.println("returning config."); return config; }
i trying create configuration object pass open method in class blazegraphembedded. however, createconfig method returns propertiesconfiguration object, method blazegraphembedded.open(repository, configuration) not accept. not able cast propertiesconfiguration configuration, produced runtime error:
exception in thread "main" java.lang.classcastexception: org.apache.commons.configuration2.propertiesconfiguration cannot cast org.apache.commons.configuration.configuration
i understand configuration interface implemented propertiesconfiguration, i'm fuzzy on details of how can use 2 different types make program run.
the problem in import statements. had:
import org.apache.commons.configuration.configuration; import org.apache.commons.configuration2.propertiesconfiguration;
so importing 2 different sources, hence why types not compatible.
Comments
Post a Comment