Record Class RuntimePermissions

java.lang.Object
java.lang.Record
dev.shamoo.runtime.core.RuntimePermissions

public record RuntimePermissions(Set<String> builtins, Set<String> readablePaths, Set<String> writablePaths, boolean network, boolean workers, boolean childProcess, boolean nativeAddons) extends Record
Canonical immutable runtime permissions derived from a manifest Node policy.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RuntimePermissions(Set<String> builtins, Set<String> readablePaths, Set<String> writablePaths, boolean network, boolean workers, boolean childProcess, boolean nativeAddons)
    Creates an instance of a RuntimePermissions record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the builtins record component.
    boolean
    Returns the value of the childProcess record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    from(dev.shamoo.runtime.protocol.NodePolicy policy)
    Converts aliases such as path and node:path to one canonical name.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the nativeAddons record component.
    boolean
    Returns the value of the network record component.
    boolean
     
    Returns the value of the readablePaths record component.
    final String
    Returns a string representation of this record class.
    boolean
    Returns the value of the workers record component.
    Returns the value of the writablePaths record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RuntimePermissions

      public RuntimePermissions(Set<String> builtins, Set<String> readablePaths, Set<String> writablePaths, boolean network, boolean workers, boolean childProcess, boolean nativeAddons)
      Creates an instance of a RuntimePermissions record class.
      Parameters:
      builtins - the value for the builtins record component
      readablePaths - the value for the readablePaths record component
      writablePaths - the value for the writablePaths record component
      network - the value for the network record component
      workers - the value for the workers record component
      childProcess - the value for the childProcess record component
      nativeAddons - the value for the nativeAddons record component
  • Method Details

    • from

      public static RuntimePermissions from(dev.shamoo.runtime.protocol.NodePolicy policy)
      Converts aliases such as path and node:path to one canonical name.
    • permitsBuiltin

      public boolean permitsBuiltin(String name)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • builtins

      public Set<String> builtins()
      Returns the value of the builtins record component.
      Returns:
      the value of the builtins record component
    • readablePaths

      public Set<String> readablePaths()
      Returns the value of the readablePaths record component.
      Returns:
      the value of the readablePaths record component
    • writablePaths

      public Set<String> writablePaths()
      Returns the value of the writablePaths record component.
      Returns:
      the value of the writablePaths record component
    • network

      public boolean network()
      Returns the value of the network record component.
      Returns:
      the value of the network record component
    • workers

      public boolean workers()
      Returns the value of the workers record component.
      Returns:
      the value of the workers record component
    • childProcess

      public boolean childProcess()
      Returns the value of the childProcess record component.
      Returns:
      the value of the childProcess record component
    • nativeAddons

      public boolean nativeAddons()
      Returns the value of the nativeAddons record component.
      Returns:
      the value of the nativeAddons record component