You can't, because you need to specify the generic of UnivariateOperator. If you just want a generic method that samples TimeSeries, you will need something like
public class TimeSeriesSampler {
public static <T> TimeSeries<T> sample(TimeSeries<T> timeseries) {
...
}
}
but if you want a SamplingOperator to implements UnivariantOperator, you will need to specify the generic. If you still don't want to specify, you could use something as
public class SamplingOperator implements UnivariateOperatior<Object> {
private SamplingOperator(){
}
public <T> TimeSeries<T> sample(TimeSeries<T> timeseries) {
return null;
}
@Override
public TimeSeries<Object> operateOn(TimeSeries<Object> timeseries) {
...
}
}
but you will lose the power of the generic. Another way is
public class SamplingOperator<S> implements UnivariateOperatior<S> {
private SamplingOperator(){
}
public <T> TimeSeries<T> sample(TimeSeries<T> timeseries) {
return null;
}
@Override
public TimeSeries<S> operateOn(TimeSeries<S> timeseries) {
return timeseries;
}
}
but it "smells" bad, as the sample method gives a feeling of a class method, instead of an instance one. It's your choice what's bst to do.