Class Transformation.Density
-
- All Implemented Interfaces:
public final class Transformation.DensitySets the output image density in dots per inch (DPI). Accepts an integer from 1 to 1200 or an arithmetic expression using the
idnvariable, such asidn_mul_2. For raster images, this updates density metadata without changing dimensions. For vector images, it controls the DPI used during rasterization. Cannot be used inside layers. See Density.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceTransformation.Density.VisitorAn interface that defines how to map each variant of Density to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<Long>integer()final Optional<String>string()final BooleanisInteger()final BooleanisString()final LongasInteger()final StringasString()final Optional<JsonValue>_json()final <T extends Any> Taccept(Transformation.Density.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final Transformation.Densityvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static Transformation.DensityofInteger(Long integer)final static Transformation.DensityofString(String string)-
-
Method Detail
-
accept
final <T extends Any> T accept(Transformation.Density.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import io.imagekit.core.JsonValue; import java.util.Optional; Optional<String> result = density.accept(new Density.Visitor<Optional<String>>() { @Override public Optional<String> visitInteger(Long integer) { return Optional.of(integer.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final Transformation.Density validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofInteger
final static Transformation.Density ofInteger(Long integer)
-
ofString
final static Transformation.Density ofString(String string)
-
-
-
-