Record Class CssBoxModel
java.lang.Object
java.lang.Record
dev.jcputney.mjml.util.CssBoxModel
- Record Components:
paddingTop- the top padding in pixelspaddingRight- the right padding in pixelspaddingBottom- the bottom padding in pixelspaddingLeft- the left padding in pixelsborderLeftWidth- the left border width in pixelsborderRightWidth- the right border width in pixels
public record CssBoxModel(double paddingTop, double paddingRight, double paddingBottom, double paddingLeft, double borderLeftWidth, double borderRightWidth)
extends Record
Calculates padding and border box dimensions from CSS shorthand values.
-
Constructor Summary
ConstructorsConstructorDescriptionCssBoxModel(double paddingTop, double paddingRight, double paddingBottom, double paddingLeft, double borderLeftWidth, double borderRightWidth) Creates an instance of aCssBoxModelrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of theborderLeftWidthrecord component.doubleReturns the value of theborderRightWidthrecord component.final booleanIndicates whether some other object is "equal to" this one.static CssBoxModelfromAttributes(String padding, String border, String borderLeft, String borderRight) Creates a CssBoxModel from padding and border attribute strings.final inthashCode()Returns a hash code value for this object.doubleTotal horizontal spacing (left + right padding + borders).doubleReturns the value of thepaddingBottomrecord component.doubleReturns the value of thepaddingLeftrecord component.doubleReturns the value of thepaddingRightrecord component.doubleReturns the value of thepaddingToprecord component.final StringtoString()Returns a string representation of this record class.doubleTotal vertical spacing (top + bottom padding).
-
Constructor Details
-
CssBoxModel
public CssBoxModel(double paddingTop, double paddingRight, double paddingBottom, double paddingLeft, double borderLeftWidth, double borderRightWidth) Creates an instance of aCssBoxModelrecord class.- Parameters:
paddingTop- the value for thepaddingToprecord componentpaddingRight- the value for thepaddingRightrecord componentpaddingBottom- the value for thepaddingBottomrecord componentpaddingLeft- the value for thepaddingLeftrecord componentborderLeftWidth- the value for theborderLeftWidthrecord componentborderRightWidth- the value for theborderRightWidthrecord component
-
-
Method Details
-
fromAttributes
public static CssBoxModel fromAttributes(String padding, String border, String borderLeft, String borderRight) Creates a CssBoxModel from padding and border attribute strings.- Parameters:
padding- the CSS padding shorthand string (e.g., "10px 20px")border- the CSS border shorthand string (e.g., "1px solid #000")borderLeft- the CSS left border shorthand stringborderRight- the CSS right border shorthand string- Returns:
- a new CssBoxModel with parsed padding and border values
-
horizontalSpacing
public double horizontalSpacing()Total horizontal spacing (left + right padding + borders).- Returns:
- the sum of left padding, right padding, left border width, and right border width
-
verticalSpacing
public double verticalSpacing()Total vertical spacing (top + bottom padding).- Returns:
- the sum of top and bottom padding
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
paddingTop
public double paddingTop()Returns the value of thepaddingToprecord component.- Returns:
- the value of the
paddingToprecord component
-
paddingRight
public double paddingRight()Returns the value of thepaddingRightrecord component.- Returns:
- the value of the
paddingRightrecord component
-
paddingBottom
public double paddingBottom()Returns the value of thepaddingBottomrecord component.- Returns:
- the value of the
paddingBottomrecord component
-
paddingLeft
public double paddingLeft()Returns the value of thepaddingLeftrecord component.- Returns:
- the value of the
paddingLeftrecord component
-
borderLeftWidth
public double borderLeftWidth()Returns the value of theborderLeftWidthrecord component.- Returns:
- the value of the
borderLeftWidthrecord component
-
borderRightWidth
public double borderRightWidth()Returns the value of theborderRightWidthrecord component.- Returns:
- the value of the
borderRightWidthrecord component
-