Class APIUtil

java.lang.Object
com.jme3.lwjgl3.utils.APIUtil

public final class APIUtil extends Object
Utility class useful to API bindings. [INTERNAL USE ONLY]

Method names in this class are prefixed with api to avoid ambiguities when used with static imports.

  • Method Details

    • toArray

      @SafeVarargs public static <T> T[] toArray(T... arguments)
      Converts dynamic arguments to object array.
      Parameters:
      arguments - the list of arguments.
      Returns:
      the object array.
    • apiBuffer

      public static APIBuffer apiBuffer()
      Returns a thread-local APIBuffer that has been reset.
    • apiStack

      public static APIBuffer apiStack()
      Returns a thread-local APIBuffer, without resetting it. This makes the APIBuffer work like a stack when used in nested API calls. The user is responsible for resetting the APIBuffer to an appropriate state before the nested call returns.
      See Also:
    • apiParseVersion

      public static APIUtil.APIVersion apiParseVersion(String version)
      Parses a version string. The version string must have the format MAJOR.MINOR.REVISION IMPL, where MAJOR is the major version (integer), MINOR is the minor version (integer), REVISION is the revision version (string, optional) and IMPL is implementation-specific information (string, optional).
      Parameters:
      version - the API version string
      Returns:
      the parsed APIUtil.APIVersion
    • apiParseVersion

      public static APIUtil.APIVersion apiParseVersion(String version, String prefix)
      Parses a version string. The version string must have the format PREFIX MAJOR.MINOR.REVISION IMPL, where PREFIX is the specified prefix (string, optional), MAJOR is the major version (integer), MINOR is the minor version (integer), REVISION is the revision version (string, optional) and IMPL is implementation-specific information (string, optional).
      Parameters:
      version - the version string
      prefix - the version string prefix, may be null
      Returns:
      the parsed APIUtil.APIVersion
    • apiUnknownToken

      public static String apiUnknownToken(int token)
    • apiUnknownToken

      public static String apiUnknownToken(String description, int token)
    • apiClassTokens

      public static Map<Integer,String> apiClassTokens(APIUtil.TokenFilter filter, Map<Integer,String> target, Class<?>... tokenClasses)
      Returns a map of public static final integer fields in the specified classes, to their String representations. An optional filter can be specified to only include specific fields. The target map may be null, in which case a new map is allocated and returned.

      This method is useful when debugging to quickly identify values returned from an API.

      Parameters:
      filter - the filter to use (optional)
      target - the target map (optional)
      tokenClasses - the classes to get tokens from
      Returns:
      the token map
    • apiOptionalClass

      public static Class<?> apiOptionalClass(String className)