Class ParseUtil

java.lang.Object
org.opentrafficsim.road.network.factory.xml.utils.ParseUtil

public final class ParseUtil
extends Object
Parser - Utility class for parsing using JAXB generated classes.

Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information www.simulation.tudelft.nl. The source code and binary code of this software is proprietary information of Delft University of Technology.
Author:
Alexander Verbraeck
  • Method Details

    • getObjectsOfType

      public static <T> List<T> getObjectsOfType​(List<?> objectList, Class<T> clazz)
      Returns all objects of given type from the list of all objects.
      Type Parameters:
      T - type
      Parameters:
      objectList - List<?>; list of objects
      clazz - Class<T>; class of type of objects to return
      Returns:
      list of all objects of given type from the list of all objects
    • findObject

      public static <T> T findObject​(List<?> objectList, Class<T> clazz, Predicate<T> predicate)
      Select object of given type by predicate.
      Type Parameters:
      T - type
      Parameters:
      objectList - List<?>; list of objects
      clazz - Class<T>; class of type of objects to return
      predicate - Predicate<T>; predicate
      Returns:
      (first) object of given type that matches the predicate
    • findObject

      public static <T> T findObject​(List<T> objectList, Predicate<T> predicate)
      Select object of given type by predicate.
      Type Parameters:
      T - type
      Parameters:
      objectList - List<T>; list of objects
      predicate - Predicate<T>; predicate
      Returns:
      (first) object of given type that matches the predicate