com.applitools.eyes.ScaleProviderFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eyes-sdk-core-java3 Show documentation
Show all versions of eyes-sdk-core-java3 Show documentation
Applitools Eyes SDK base for Java
The newest version!
package com.applitools.eyes;
import com.applitools.utils.PropertyHandler;
/**
* Abstraction for instantiating scale providers.
*/
public abstract class ScaleProviderFactory {
protected Logger logger;
private final PropertyHandler scaleProviderHandler;
/**
*
* @param logger The logger to use.
* @param scaleProviderHandler A handler to update once a {@link ScaleProvider} instance is created.
*/
public ScaleProviderFactory(Logger logger, PropertyHandler scaleProviderHandler) {
this.logger = logger;
this.scaleProviderHandler = scaleProviderHandler;
}
/**
* The main API for this factory.
*
* @param imageToScaleWidth The width of the image to scale. This parameter CAN be by class implementing
* the factory, but this is not mandatory.
* @return A {@link ScaleProvider} instance.
*/
public ScaleProvider getScaleProvider(int imageToScaleWidth) {
ScaleProvider scaleProvider = getScaleProviderImpl(imageToScaleWidth);
scaleProviderHandler.set(scaleProvider);
return scaleProvider;
}
/**
* The implementation of getting/creating the scale provider, should be implemented by child classes.
*
*
* @param imageToScaleWidth The width of the image to scale. This parameter CAN be by class implementing
* the factory, but this is not mandatory.
* @return The scale provider to be used.
*/
protected abstract ScaleProvider getScaleProviderImpl(int imageToScaleWidth);
}