Class CornerRadii

  • All Implemented Interfaces:
    java.io.Serializable

    public final class CornerRadii
    extends java.lang.Object
    implements java.io.Serializable
    Class representing the corner radii of a rectangular object.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BOTTOM_LEFT_KEY
      Dictionary key for the bottom left value.
      static java.lang.String BOTTOM_RIGHT_KEY
      Dictionary key for the bottom right value.
      int bottomLeft
      Radius of the bottom left corner.
      int bottomRight
      Radius of the bottom right corner.
      static CornerRadii NONE
      Corner radii whose top, left, bottom, and right values are all zero.
      static java.lang.String TOP_LEFT_KEY
      Dictionary key for the top left value.
      static java.lang.String TOP_RIGHT_KEY
      Dictionary key for the top right value.
      int topLeft
      Radius of the top left corner.
      int topRight
      Radius of the top right corner.
    • Constructor Summary

      Constructors 
      Constructor Description
      CornerRadii​(int radius)
      Construct with a single value for all four corners.
      CornerRadii​(int topLeftValue, int topRightValue, int bottomLeftValue, int bottomRightValue)
      Construct given the individual corner radius values.
      CornerRadii​(java.lang.Number radius)
      Construct with a single value for all corners.
      CornerRadii​(Dictionary<java.lang.String,​?> cornerRadii)
      Construct a CornerRadii object from a dictionary specifying values for each of the four corners.
      CornerRadii​(Sequence<?> cornerRadii)
      Construct from a sequence of four numeric values.
      CornerRadii​(CornerRadii cornerRadii)
      "Copy" constructor from another corner radii object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static CornerRadii decode​(java.lang.String value)
      Convert a string into corner radii.
      boolean equals​(java.lang.Object object)  
      static CornerRadii fromObject​(java.lang.Object source)
      Convert any of our supported object sources into a CornerRadii object.
      int hashCode()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • topLeft

        public final int topLeft
        Radius of the top left corner.
      • topRight

        public final int topRight
        Radius of the top right corner.
      • bottomLeft

        public final int bottomLeft
        Radius of the bottom left corner.
      • bottomRight

        public final int bottomRight
        Radius of the bottom right corner.
      • TOP_LEFT_KEY

        public static final java.lang.String TOP_LEFT_KEY
        Dictionary key for the top left value.
        See Also:
        Constant Field Values
      • TOP_RIGHT_KEY

        public static final java.lang.String TOP_RIGHT_KEY
        Dictionary key for the top right value.
        See Also:
        Constant Field Values
      • BOTTOM_LEFT_KEY

        public static final java.lang.String BOTTOM_LEFT_KEY
        Dictionary key for the bottom left value.
        See Also:
        Constant Field Values
      • BOTTOM_RIGHT_KEY

        public static final java.lang.String BOTTOM_RIGHT_KEY
        Dictionary key for the bottom right value.
        See Also:
        Constant Field Values
      • NONE

        public static final CornerRadii NONE
        Corner radii whose top, left, bottom, and right values are all zero.
    • Constructor Detail

      • CornerRadii

        public CornerRadii​(int radius)
        Construct with a single value for all four corners.
        Parameters:
        radius - The single value for all corners.
      • CornerRadii

        public CornerRadii​(java.lang.Number radius)
        Construct with a single value for all corners.
        Parameters:
        radius - The (integer) value for all corners.
      • CornerRadii

        public CornerRadii​(CornerRadii cornerRadii)
        "Copy" constructor from another corner radii object.
        Parameters:
        cornerRadii - The other object to copy from.
        Throws:
        java.lang.IllegalArgumentException - if the object is null.
      • CornerRadii

        public CornerRadii​(int topLeftValue,
                           int topRightValue,
                           int bottomLeftValue,
                           int bottomRightValue)
        Construct given the individual corner radius values.
        Parameters:
        topLeftValue - The new top left radius value.
        topRightValue - The new top right radius value.
        bottomLeftValue - The new bottom left radius.
        bottomRightValue - The bottom right radius value.
        Throws:
        java.lang.IllegalArgumentException - if any of the values are negative.
      • CornerRadii

        public CornerRadii​(Dictionary<java.lang.String,​?> cornerRadii)
        Construct a CornerRadii object from a dictionary specifying values for each of the four corners.
        Parameters:
        cornerRadii - A dictionary with keys "topLeft", "topRight", "bottomLeft", "bottomRight", all with numeric values. Omitted values are treated as zero.
      • CornerRadii

        public CornerRadii​(Sequence<?> cornerRadii)
        Construct from a sequence of four numeric values.
        Parameters:
        cornerRadii - Sequence of values in the order of: top left, top right, bottom left, bottom right.
        Throws:
        java.lang.IllegalArgumentException - if the input is null or if any of the values are negative.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fromObject

        public static CornerRadii fromObject​(java.lang.Object source)
        Convert any of our supported object sources into a CornerRadii object.
        Parameters:
        source - Any supported object (Integer, Number, String, etc.).
        Returns:
        The constructed CornerRadii object.
        Throws:
        java.lang.IllegalArgumentException - if the source if null or we can't figure out how to convert.
      • decode

        public static CornerRadii decode​(java.lang.String value)
        Convert a string into corner radii.

        If the string value is a JSON map, then parse the map and construct using the CornerRadii(Dictionary) method.

        If the string value is a JSON list, then parse the list and construct using the first four values as top left, top right, bottom left, and bottom right respectively, using the CornerRadii(int, int, int, int) constructor.

        A form of 4 integers values separate by commas or semicolons is also accepted, as in "n, n; n, n", where the values are in the same order as the JSON list form.

        Otherwise the string should be a single integer value that will be used to construct the radii using the CornerRadii(int) constructor.

        Parameters:
        value - The string value to decode into new corner radii.
        Returns:
        The decoded corner radii.
        Throws:
        java.lang.IllegalArgumentException - if the value is null or if the string starts with "{" but it cannot be parsed as a JSON map, or if it starts with "[" but cannot be parsed as a JSON list.