Class CodeFinder

java.lang.Object
org.gcube.common.gxrest.response.outbound.CodeFinder

public class CodeFinder extends Object
Helper methods to find an error code in an enumeration implementing ErrorCode.
Author:
Manuele Simi (ISTI CNR), Luca Frosini (ISTI-CNR)
  • Constructor Details

    • CodeFinder

      public CodeFinder()
  • Method Details

    • findAndConvert

      public static <E extends Enum<E> & ErrorCode> E findAndConvert(ErrorCode code, E[] codes)
      Finds and convert the given code as enum value.
      Type Parameters:
      E - the type of the enum
      Parameters:
      code - the code to look for.
      codes - the enum values.
      Returns:
      the code as enum value or null if the code is not found.