Package cil.li.oc

Class Components

java.lang.Object
cil.li.oc.Components

public final class Components
extends java.lang.Object
Class used to access the component API.
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String doc​(java.lang.String address, java.lang.String method)
    Returns the documentation string for the method with the specified name of the component with the specified address, if any.
    static <T extends ComponentProxy>
    T
    getPrimary​(java.lang.String type)
    Gets the proxy for the primary component of the specified type.
    Throws an error if there is no primary component of the specified type.
    static java.lang.String getPrimaryAddress​(java.lang.String type)
    Get the primary component.
    Unlike Lua, this returns the address.
    static <T extends ComponentProxy>
    T
    getProxy​(java.lang.String address)
    Gets a 'proxy' object for a component, this provides all methods the component provides so they can be called more directly (instead of via invoke).
    static java.lang.Object[] invoke​(java.lang.String address, java.lang.String method, java.lang.Object... args)
    Invoke component's method with specified component address and with arguments args
    This returns all the results of the call.
    If needed, objects are serialized to lua objects, in that case, Object can be one of: Integer Long Map (mapped to a table) Double
    Functions are serialized to their java.util.function equivalent.
    static LuaObject[] invoke​(java.lang.String address, java.lang.String method, LuaObject[] args)
    SPECIFIC TO LUKYT : should not actually be used, this was some support function for complex lua object types but shouldn't be used now.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • doc

      public static java.lang.String doc​(java.lang.String address, java.lang.String method)
      Returns the documentation string for the method with the specified name of the component with the specified address, if any.
    • invoke

      public static java.lang.Object[] invoke​(java.lang.String address, java.lang.String method, java.lang.Object... args)
      Invoke component's method with specified component address and with arguments args
      This returns all the results of the call.
      If needed, objects are serialized to lua objects, in that case, Object can be one of:
      • Integer
      • Long
      • Map (mapped to a table)
      • Double

      Functions are serialized to their java.util.function equivalent. That serialization is also applied to results.
    • getPrimaryAddress

      public static java.lang.String getPrimaryAddress​(java.lang.String type)
      Get the primary component.
      Unlike Lua, this returns the address.
      Throws:
      java.lang.UnsupportedOperationException - when the environment doesn't support getPrimary() (ex: no OS or the OS doesn't use that function).
    • getPrimary

      public static <T extends ComponentProxy> T getPrimary​(java.lang.String type)
      Gets the proxy for the primary component of the specified type.
      Throws an error if there is no primary component of the specified type.
    • getProxy

      public static <T extends ComponentProxy> T getProxy​(java.lang.String address)
      Gets a 'proxy' object for a component, this provides all methods the component provides so they can be called more directly (instead of via invoke). This is what's used to generate 'primaries' of the individual component types, i.e. what you get via getPrimary(String)
    • invoke

      public static LuaObject[] invoke​(java.lang.String address, java.lang.String method, LuaObject[] args)
      SPECIFIC TO LUKYT : should not actually be used, this was some support function for complex lua object types but shouldn't be used now.