private boolean setLocation(String global, String context, Map<String, Object> properties) {
        String locationKey = "location." + context;
        Object propvalue = properties.get(locationKey);
        if (propvalue == null) {
            properties.put(locationKey, global);
        } else if (propvalue.getClass().isArray()) {
            Object[] locations = (Object[]) propvalue;
            if (ArrayUtils.contains(locations, global)) {
                return false;
            }
            Object[] newArray = Arrays.copyOf(locations, locations.length + 1);
            newArray[locations.length] = global;
            properties.put(locationKey, newArray);
        } else {
            if (((String) propvalue).equals(global)) {
                return false;
            }
            Object[] newArray = new Object[2];
            newArray[0] = propvalue;
            newArray[1] = global;
            properties.put(locationKey, newArray);
        }
        return true;
    }
private boolean setLocation ( String global , String context , Map < String , Object > properties ) { String locationKey = "location." + context ; Object propvalue = properties . get ( locationKey ) ; if ( propvalue == null ) { properties . put ( locationKey , global ) ; } else if ( propvalue . getClass ( ) . isArray ( ) ) { Object [ ] locations = ( Object [ ] ) propvalue ; if ( ArrayUtils . contains ( locations , global ) ) { return false ; } Object [ ] newArray = Arrays . copyOf ( locations , locations . length + 1 ) ; newArray [ locations . length ] = global ; properties . put ( locationKey , newArray ) ; } else { if ( ( ( String ) propvalue ) . equals ( global ) ) { return false ; } Object [ ] newArray = new Object [ 2 ] ; newArray [ 0 ] = propvalue ; newArray [ 1 ] = global ; properties . put ( locationKey , newArray ) ; } return true ; }
returns true if location is not already set in the properties, otherwise false