Enum DefaultValueStructureAccessor

    • Enum Constant Detail

    • Method Detail

      • values

        public static DefaultValueStructureAccessor[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DefaultValueStructureAccessor c : DefaultValueStructureAccessor.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DefaultValueStructureAccessor valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • asPrimitive

        public Object asPrimitive​(Object value)
        Description copied from interface: IValueStructureAccessor
        If the value is a primitive, returns the unwrapped primitive value. E.g. for a boolean, should return a Boolean. Unspecified behavior if the value is not a primitive.
        Specified by:
        asPrimitive in interface IValueStructureAccessor
        Parameters:
        value - The primitive value to access.
        Returns:
        The primitive value.
      • isList

        public boolean isList​(Object value)
        Description copied from interface: IValueStructureAccessor
        Checks if the given value is a list of items.
        Specified by:
        isList in interface IValueStructureAccessor
        Parameters:
        value - The value to check.
        Returns:
        True if the value is a list, false otherwise.
      • isMap

        public boolean isMap​(Object value)
        Description copied from interface: IValueStructureAccessor
        Checks if the given value is a map of key-value pairs.
        Specified by:
        isMap in interface IValueStructureAccessor
        Parameters:
        value - The value to check.
        Returns:
        True if the value is a map, false otherwise.
      • isPrimitive

        public boolean isPrimitive​(Object value)
        Description copied from interface: IValueStructureAccessor
        Checks if the given value is a primitive value, i.e. not a container (list or map).
        Specified by:
        isPrimitive in interface IValueStructureAccessor
        Parameters:
        value - The value to check.
        Returns:
        True if the value is a primitive, false otherwise.
      • listGet

        public Object listGet​(Object list,
                              int index)
        Description copied from interface: IValueStructureAccessor
        If the value is a list, gets the item at the given index. Unspecified behavior if the value is not a list.
        Specified by:
        listGet in interface IValueStructureAccessor
        Parameters:
        list - The list with items to access.
        index - The index of the item to access.
        Returns:
        The item at the given index.
      • listSize

        public int listSize​(Object value)
        Description copied from interface: IValueStructureAccessor
        If the value is a list, gets the number of items in the list. Unspecified behavior if the value is not a list.
        Specified by:
        listSize in interface IValueStructureAccessor
        Parameters:
        value - The list to get the size of.
        Returns:
        The number of items in the list.
      • mapGet

        public Object mapGet​(Object map,
                             Object key)
        Description copied from interface: IValueStructureAccessor
        If the value is a map, gets the value for the given key. Unspecified behavior if the value is not a map.
        Specified by:
        mapGet in interface IValueStructureAccessor
        Parameters:
        map - The map with key-value pairs to access.
        key - The key of the value to access.
        Returns:
        The value for the given key, or null if the key does not exist in the map.
      • mapKeys

        public Collection<?> mapKeys​(Object map)
        Description copied from interface: IValueStructureAccessor
        If the value is a map, gets the keys of the map. Unspecified behavior if the value is not a map.
        Specified by:
        mapKeys in interface IValueStructureAccessor
        Parameters:
        map - The map with key-value pairs to access.
        Returns:
        The keys of the map.