private QueryExp buildOptionalQueryExp(final String[] attributes,final Object[] values){
  QueryExp queryExp=null;
  for (int i=0; i < attributes.length; i++) {
    if (values[i] instanceof Boolean) {
      if (queryExp == null) {
        queryExp=Query.eq(Query.attr(attributes[i]),Query.value(((Boolean)values[i])));
      }
 else {
        queryExp=Query.and(queryExp,Query.eq(Query.attr(attributes[i]),Query.value(((Boolean)values[i]))));
      }
    }
 else     if (values[i] instanceof Number) {
      if (queryExp == null) {
        queryExp=Query.eq(Query.attr(attributes[i]),Query.value((Number)values[i]));
      }
 else {
        queryExp=Query.and(queryExp,Query.eq(Query.attr(attributes[i]),Query.value((Number)values[i])));
      }
    }
 else     if (values[i] instanceof String) {
      if (queryExp == null) {
        queryExp=Query.eq(Query.attr(attributes[i]),Query.value((String)values[i]));
      }
 else {
        queryExp=Query.and(queryExp,Query.eq(Query.attr(attributes[i]),Query.value((String)values[i])));
      }
    }
  }
  return queryExp;
}

private QueryExp buildOptionalQueryExp ( final String [ ] attributes , final Object [ ] values ) { QueryExp queryExp = null ; for ( int i = 0 ; i < attributes . length ; i ++ ) { if ( values [ i ] instanceof Boolean ) { if ( queryExp == null ) { queryExp = Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( ( Boolean ) values [ i ] ) ) ) ; } else { queryExp = Query . and ( queryExp , Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( ( Boolean ) values [ i ] ) ) ) ) ; } } else if ( values [ i ] instanceof Number ) { if ( queryExp == null ) { queryExp = Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( Number ) values [ i ] ) ) ; } else { queryExp = Query . and ( queryExp , Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( Number ) values [ i ] ) ) ) ; } } else if ( values [ i ] instanceof String ) { if ( queryExp == null ) { queryExp = Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( String ) values [ i ] ) ) ; } else { queryExp = Query . and ( queryExp , Query . eq ( Query . attr ( attributes [ i ] ) , Query . value ( ( String ) values [ i ] ) ) ) ; } } } return queryExp ; }
builds an optional queryexp to aid in matching the correct mbean using additional attributes with the specified values . returns null if no attributes and values were specified during construction .
