Record Class CssValues.CssDimension
java.lang.Object
java.lang.Record
org.eclipse.e4.ui.css.core.impl.dom.CssValues.CssDimension
- All Implemented Interfaces:
CssValues.CssNumeric, CssValues.CssPrimitive, CssValues.CssValue, CSSPrimitiveValue, CSSValue
- Enclosing class:
CssValues
public static record CssValues.CssDimension(double value, CssValues.CssUnit unit, String unitText)
extends Record
implements CssValues.CssNumeric
26px, 30%, 75em - a number with a unit.
unitText keeps the source spelling for units the CssValues.CssUnit
enum does not model (CssValues.CssUnit.OTHER).-
Field Summary
Fields inherited from interface CSSPrimitiveValue
CSS_ATTR, CSS_CM, CSS_COUNTER, CSS_DEG, CSS_DIMENSION, CSS_EMS, CSS_EXS, CSS_GRAD, CSS_HZ, CSS_IDENT, CSS_IN, CSS_KHZ, CSS_MM, CSS_MS, CSS_NUMBER, CSS_PC, CSS_PERCENTAGE, CSS_PT, CSS_PX, CSS_RAD, CSS_RECT, CSS_RGBCOLOR, CSS_S, CSS_STRING, CSS_UNKNOWN, CSS_URIFields inherited from interface CSSValue
CSS_CUSTOM, CSS_INHERIT, CSS_PRIMITIVE_VALUE, CSS_VALUE_LIST -
Constructor Summary
ConstructorsConstructorDescriptionCssDimension(double value, CssValues.CssUnit unit) CssDimension(double value, CssValues.CssUnit unit, String unitText) Creates an instance of aCssDimensionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.floatgetFloatValue(short unitType) shortfinal inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.unit()Returns the value of theunitrecord component.unitText()Returns the value of theunitTextrecord component.doublevalue()Returns the value of thevaluerecord component.Methods inherited from interface CssValues.CssPrimitive
getCounterValue, getCssValueType, getRectValue, getRGBColorValue, getStringValue, setCssText, setFloatValue, setStringValue
-
Constructor Details
-
CssDimension
-
CssDimension
Creates an instance of aCssDimensionrecord class.- Parameters:
value- the value for thevaluerecord componentunit- the value for theunitrecord componentunitText- the value for theunitTextrecord component
-
-
Method Details
-
getPrimitiveType
public short getPrimitiveType()- Specified by:
getPrimitiveTypein interfaceCSSPrimitiveValue
-
getFloatValue
public float getFloatValue(short unitType) - Specified by:
getFloatValuein interfaceCSSPrimitiveValue- Specified by:
getFloatValuein interfaceCssValues.CssPrimitive
-
getCssText
- Specified by:
getCssTextin interfaceCSSValue
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
value
public double value()Returns the value of thevaluerecord component.- Specified by:
valuein interfaceCssValues.CssNumeric- Returns:
- the value of the
valuerecord component
-
unit
Returns the value of theunitrecord component.- Specified by:
unitin interfaceCssValues.CssNumeric- Returns:
- the value of the
unitrecord component
-
unitText
Returns the value of theunitTextrecord component.- Returns:
- the value of the
unitTextrecord component
-