src/main/java/com/digitalglobe/util/maven/plugin/CloudFormationDeployMavenPlugin.java
/**
     * This method process a parameter as if it where an object representing an array list of dictionary items or
     * strings.  It extracts the array element from the array list based on an index or a dictionary filter.
     *
     * @param parameter is the parameter that represents an array list to process.
     * @param array is the contents of the array brackets which could be an index or a dictionary filter.
     * @param extractString signals if this is the intent is to process and array of strings.
     * @return the contents of the selected array element which could be a dictionary or string.
     */
This method process a parameter as if it where an object representing an array list of dictionary items or
strings.  It extracts the array element from the array list based on an index or a dictionary filter.

@param parameter is the parameter that represents an array list to process.
@param array is the contents of the array brackets which could be an index or a dictionary filter.
@param extractString signals if this is the intent is to process and array of strings.
@return the contents of the selected array element which could be a dictionary or string.
This method process a parameter as if it where an object representing an array list of dictionary items or strings . It extracts the array element from the array list based on an index or a dictionary filter . @param parameter is the parameter that represents an array list to process . @param array is the contents of the array brackets which could be an index or a dictionary filter . @param extractString signals if this is the intent is to process and array of strings . @return the contents of the selected array element which could be a dictionary or string .
private Object processArray(Object parameter, String array, boolean extractString) throws MojoExecutionException {
        if(!parameter.getClass().isAssignableFrom(ArrayList.class))
            throw new MojoExecutionException("Invalid parameter type.");
        if(Pattern.matches("^[0-9]+$", array)) {
            if (((ArrayList) parameter).size() >= (Integer.parseInt(array) + 1)) {
                parameter = ((ArrayList) parameter).get(Integer.parseInt(array));
                if(parameter.getClass().isAssignableFrom(String.class) && !extractString) parameter = null;
            } else  parameter = null;
        } else {
            Pattern pattern = Pattern.compile("^([A-Za-z0-9_-]+)=([A-Za-z0-9_ /-]+)$");
            Matcher arrayMatcher = pattern.matcher(array);
            if(!arrayMatcher.matches())
                throw new MojoExecutionException("Invalid group filter.");
            List list = (List)((ArrayList)parameter)
                    .stream()
                    .filter(item -> ((LinkedHashMap)item).get(arrayMatcher.group(1))
                            .equals(arrayMatcher.group(2)))
                    .collect(Collectors.toList());
            if(list.size() > 1) throw new MojoExecutionException("Too many matches.");
            if(list.size() == 1) parameter = list.get(0);
            else parameter = null;
        }
        return parameter;
    }
private Object processArray ( Object parameter , String array , boolean extractString ) throws MojoExecutionException { if ( ! parameter . getClass ( ) . isAssignableFrom ( ArrayList . class ) ) throw new MojoExecutionException ( "Invalid parameter type." ) ; if ( Pattern . matches ( "^[0-9]+$" , array ) ) { if ( ( ( ArrayList ) parameter ) . size ( ) >= ( Integer . parseInt ( array ) + 1 ) ) { parameter = ( ( ArrayList ) parameter ) . get ( Integer . parseInt ( array ) ) ; if ( parameter . getClass ( ) . isAssignableFrom ( String . class ) && ! extractString ) parameter = null ; } else parameter = null ; } else { Pattern pattern = Pattern . compile ( "^([A-Za-z0-9_-]+)=([A-Za-z0-9_ /-]+)$" ) ; Matcher arrayMatcher = pattern . matcher ( array ) ; if ( ! arrayMatcher . matches ( ) ) throw new MojoExecutionException ( "Invalid group filter." ) ; List list = ( List ) ( ( ArrayList ) parameter ) . stream ( ) . filter ( item -> ( ( LinkedHashMap ) item ) . get ( arrayMatcher . group ( 1 ) ) . equals ( arrayMatcher . group ( 2 ) ) ) . collect ( Collectors . toList ( ) ) ; if ( list . size ( ) > 1 ) throw new MojoExecutionException ( "Too many matches." ) ; if ( list . size ( ) == 1 ) parameter = list . get ( 0 ) ; else parameter = null ; } return parameter ; }
This method process a parameter as if it where an object representing an array list of dictionary items or
 strings.
This method process a parameter as if it where an object representing an array list of dictionary items or strings .
// Array represents an index. // Array represents a filter query for an array element.