Interface TypeFriendlyMap<K,​V>

    • Method Detail

      • fromMap

        static <K,​V> TypeFriendlyMap<K,​V> fromMap​(Map<K,​V> input)
        Decorates the input Map with the TypeFriendlyMap interface.

        This does not make a copy of the input. All Map interface methods will be delegated to the decorated Map.

        Type Parameters:
        K - The key type
        V - The value type
        Parameters:
        input - The input map to decorate
        Returns:
        The decorated Map object
      • getAs

        default <T extends V> T getAs​(K key,
                                      Class<T> targetClass)
        Gets the given value cast to the given type.

        If the value is null, a null will be returned. If the value cannot be cast to the given type, a ClassCastException will be thrown.

        Type Parameters:
        T - The output type
        Parameters:
        key - The key to get the value for
        targetClass - The target class to cast the value to
        Returns:
        The output object cast to the given class
        Throws:
        ClassCastException - if the value is not compatible with the target class
      • getInt

        default int getInt​(K key)
      • getLong

        default long getLong​(K key)
      • getSailPointObject

        default <T extends sailpoint.object.SailPointObject> T getSailPointObject​(K key,
                                                                                  sailpoint.api.SailPointContext context,
                                                                                  Class<T> targetClass)
                                                                           throws sailpoint.tools.GeneralException
        Gets the given value cast to the given SailPointObject type.

        If the stored value is a String and not the target type, it will be assumed to be a name or ID and the SailPointContext provided will be invoked to look it up.

        Type Parameters:
        T - The SailPointObject type to query
        Parameters:
        key - The key to get the value for
        targetClass - The target class to cast the value to
        Returns:
        The output object cast to the given class
        Throws:
        ClassCastException - if the value is not compatible with the target class
        sailpoint.tools.GeneralException - if any errors occur reading the SPO from the context