org.jpmml.model.visitors.PMMLObjectInterner Maven / Gradle / Ivy
/*
* Copyright (c) 2022 Villu Ruusmann
*/
package org.jpmml.model.visitors;
import java.util.Objects;
import org.dmg.pmml.PMMLObject;
import org.jpmml.model.PMMLObjectCache;
abstract
public class PMMLObjectInterner extends ElementInterner {
private PMMLObjectCache cache = null;
protected PMMLObjectInterner(Class extends E> type, PMMLObjectCache cache){
super(type);
setCache(cache);
}
@Override
public E intern(E object){
PMMLObjectCache cache = getCache();
return cache.intern(object);
}
public PMMLObjectCache getCache(){
return this.cache;
}
private void setCache(PMMLObjectCache cache){
this.cache = Objects.requireNonNull(cache);
}
}