
pl.edu.icm.unity.stdext.attr.BaseImageAttributeSyntax Maven / Gradle / Ivy
/*
* Copyright (c) 2018 Bixbit - Krzysztof Benedyczak All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package pl.edu.icm.unity.stdext.attr;
import com.fasterxml.jackson.databind.JsonNode;
import pl.edu.icm.unity.engine.api.attributes.AttributeValueSyntax;
import pl.edu.icm.unity.stdext.utils.ImageConfiguration;
/**
* Image attribute value syntax. Allows for specifying size and dimension
* limits. The input and output of the attribute is any BufferedImage, but
* internally the image is stored as original image format with all the
* consequences.
*
* Note: for performance reasons the equals is implemented to always return
* false, so each image is always assumed to be different then another.
*
* @author K. Benedyczak, R. Ledzinski
*/
public abstract class BaseImageAttributeSyntax implements AttributeValueSyntax
{
private final ImageConfiguration config = new ImageConfiguration();
@Override
public JsonNode getSerializedConfiguration()
{
return config.getSerializedConfiguration();
}
@Override
public void setSerializedConfiguration(JsonNode jsonN)
{
config.setSerializedConfiguration(jsonN);
}
public ImageConfiguration getConfig()
{
return config;
}
@Override
public boolean areEqual(T value, Object anotherO)
{
return false;
}
@Override
public int getMaxSize()
{
return config.getMaxSize();
}
@Override
public int hashCode(Object value)
{
return value.hashCode();
}
@Override
public boolean isEmailVerifiable()
{
return false;
}
@Override
public boolean isUserVerifiable()
{
return false;
}
}