Package com.cumulocity.me.lang

Examples of com.cumulocity.me.lang.Iterator


   
    public RepresentationValidationServiceImpl() {
    }
   
    public RepresentationValidationServiceImpl(Collection collection) {
    Iterator iterator = collection.iterator();
        while (iterator.hasNext()) {
            Object validator = iterator.next();
            if (!(validator instanceof RepresentationValidator)) {
                throw new IllegalArgumentException(validator + " must be a RepresentationValidator!");
            }
            register((RepresentationValidator) validator);
        }
View Full Code Here


        }
        return findValidator(representation.getClass()).isValid(representation, context);
    }
   
    private RepresentationValidator findValidator(Class representationType) {
      Iterator iterator = validators.iterator();
        while (iterator.hasNext()) {
            RepresentationValidator validator = ((RepresentationValidator) iterator.next());
            if (validator.supports(representationType)) {
                return validator;
            }
        }
        return NoOpRepresentationValidator.getInstance();
View Full Code Here

            return templateUrlParser.replacePlaceholdersWithParams(uri, filters);
        }
    }

    private String findQueryURI(List uriTemplates, Set parameters) {
        Iterator i = uriTemplates.iterator();
        while (i.hasNext()) {
            String uri = (String) i.next();
            List queryParams = getQueryParams(uri);

            List queryDelta = findDelta(parameters, queryParams);
            List paramDelta = findDelta(queryParams, parameters);
View Full Code Here

        }
        return null;
    }

    private String removeOptionals(String uri, List optionals) {
        Iterator i = optionals.iterator();
        while (i.hasNext()) {
            String param = (String) i.next();
            uri = StringUtils.replaceAll(uri, param + "={" + param + "}", "");
        }
        // remove duplicate &
        uri = StringUtils.replaceAll(uri, "&&", "&");
        uri = StringUtils.replaceAll(uri, "?&", "?");
View Full Code Here

        return uri;
    }

    private List findDelta(Collection in, Collection from) {
        List delta = new ArrayList();
        Iterator fromIterator = from.iterator();
        while (fromIterator.hasNext()) {
            String p = (String) fromIterator.next();
            boolean found = false;
           
            Iterator inIterator = in.iterator();
            while (!found && inIterator.hasNext()) {
                found = p.equals((String) inIterator.next());
            }
           
            if (!found) {
                delta.add(p);
            }
View Full Code Here

        return delta;
    }

    private int getOptionalCount(Collection parameters) {
        int count = 0;
        Iterator i = parameters.iterator();
        while (i.hasNext()) {
            String param = (String) i.next();
            if (isOptional(param)) {
                count++;
            }
        }
        return count;
View Full Code Here

        }
        return sbuf.toString();
    }

    public String replacePlaceholdersWithParams(String template, Map params) {
        Iterator iterator = params.entrySet().iterator();
        while (iterator.hasNext()) {
            Entry entry = (Entry) iterator.next();
            template = replaceAll(template, asPattern((String) entry.getKey()), encode((String) entry.getValue()));
        }
        return template;
    }
View Full Code Here

    this.subtype = subtype == null ? MEDIA_TYPE_WILDCARD : subtype;
    if (parameters == null) {
      this.parameters = Collections.emptyMap();
    } else {
      Map map = new HashMap();
      Iterator iterator = parameters.entrySet().iterator();
      while (iterator.hasNext()) {
        Map.Entry e = (Entry) iterator.next();
        map.put(((String) e.getKey()).toLowerCase(), e.getValue());
      }
      this.parameters = map;
    }
  }
View Full Code Here

            eventsOn1stPage = getEventsFrom1stPage();
        }
    }

    private void deleteMOs(List mosOn1stPage) throws SDKException {
        Iterator iterator = mosOn1stPage.iterator();
        while (iterator.hasNext()) {
            eventApi.delete((EventRepresentation) iterator.next());
        }
    }
View Full Code Here

   
    public JsonConversionServiceImpl() {
    }
   
    public JsonConversionServiceImpl(Collection collection) {
    Iterator iterator = collection.iterator();
        while (iterator.hasNext()) {
            Object converter = iterator.next();
            if (!(converter instanceof JsonConverter)) {
                throw new IllegalArgumentException(converter + " must be a JsonConverter!");
            }
            register((JsonConverter) converter);
        }
View Full Code Here

TOP

Related Classes of com.cumulocity.me.lang.Iterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.