Interface CalculatedSubject

    • Method Detail

      • identifier

        SubjectRef<?> identifier()
        Get the identifier for this subject, as a map entry where the key is the identifier for this subject's type and the value is the specific identifier for this subject.
        Returns:
        The identifier
      • permissions

        default NodeTree permissions()
        Get the permissions tree in this subject's active contexts.
        Returns:
        A node tree with the calculated permissions
      • permissions

        NodeTree permissions​(Set<ContextValue<?>> contexts)
        Get the permissions tree for a certain set of contexts.
        Parameters:
        contexts - The contexts to get permissions in
        Returns:
        A node tree with the calculated permissions
      • options

        default Map<String,​Stringoptions()
        Get all options for this subject's active contexts. Options are plain strings and therefore do not have wildcard handling.
        Returns:
        A map of option keys to values
      • options

        Map<String,​Stringoptions​(Set<ContextValue<?>> contexts)
        Get all options for a certain set of contexts. Options are plain strings and therefore do not have wildcard handling.
        Parameters:
        contexts - The contexts to query
        Returns:
        A map of option keys to values
      • parents

        default List<SubjectRef<?>> parents()
        Get a list of all parents inheriting from this subject in the active contexts.
        Returns:
        The list of parents that apply to this subject
      • parents

        List<SubjectRef<?>> parents​(Set<ContextValue<?>> contexts)
        Get a list of all parents inheriting from this subject.
        Parameters:
        contexts - The contexts to check
        Returns:
        The list of parents that apply to this subject
      • permission

        default int permission​(String permission)
        Query a specific permission in this subject's active contexts This method takes into account context and wildcard inheritance calculations for any permission.

        Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.

        Parameters:
        permission - The permission to query
        Returns:
        The permission value. <0 evaluates to false, 0 is undefined, and >0 evaluates to true.
      • permission

        int permission​(Set<ContextValue<?>> contexts,
                       String permission)
        Query a specific permission in a certain set of contexts. This method takes into account context and wildcard inheritance calculations for any permission.

        Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.

        Parameters:
        contexts - The contexts to check in
        permission - The permission to query
        Returns:
        The permission value. <0 evaluates to false, 0 is undefined, and >0 evaluates to true.
      • hasPermission

        default boolean hasPermission​(String permission)
        Query whether this subject has a specific permission in this subject's active contexts This method takes into account context and wildcard inheritance calculations for any permission.

        Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.

        Parameters:
        permission - The permission to query
        Returns:
        Whether the subject has a true permissions value
      • hasPermission

        boolean hasPermission​(Set<ContextValue<?>> contexts,
                              String permission)
        Query whether this subject has a specific permission in the provided contexts This method takes into account context and wildcard inheritance calculations for any permission.

        Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.

        Parameters:
        contexts - The contexts to query this permission in
        permission - The permission to query
        Returns:
        Whether the subject has a true permissions value
      • option

        default Optional<Stringoption​(String option)
        Get an option that may be present for a certain subject in the subject's active contexts

        Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.

        Parameters:
        option - The option to query
        Returns:
        The option, if set
      • option

        Optional<Stringoption​(Set<ContextValue<?>> contexts,
                                String option)
        Get an option that may be present for a certain subject

        Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.

        Parameters:
        contexts - The contexts to check in
        option - The option to query
        Returns:
        The option, if set
      • optionNode

        default org.spongepowered.configurate.ConfigurationNode optionNode​(String option)
        Get an option from this subject. The value will be returned as a ConfigurationNode to allow easily accessing its data.

        Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.

        Parameters:
        option - The option to query
        Returns:
        The option, if set
      • optionNode

        org.spongepowered.configurate.ConfigurationNode optionNode​(Set<ContextValue<?>> contexts,
                                                                   String option)
        Get an option from this subject. The value will be returned as a ConfigurationNode to allow easily accessing its data. Any checks made through this method will be logged by the PermissionCheckNotifier registered with the PEX engine.
        Parameters:
        contexts - The contexts to check in
        option - The option to query
        Returns:
        The option, if set
      • data

        SubjectRef.ToData<?> data()
        Access this subject's persistent data.
        Returns:
        A reference to the persistent data of this subject
      • transientData

        SubjectRef.ToData<?> transientData()
        Access this subject's transient data.
        Returns:
        A reference to the transient data of this subject
      • associatedObject

        @Nullable Object associatedObject()
        Get a native object associated with this subject.

        This object is provided by the SubjectType responsible for this subject's type.

        Returns:
        a native object
      • registerListener

        void registerListener​(Consumer<CalculatedSubject> listener)
        Register a listener that will receive updates to this subject. A reference to the listener will be held, so when updates are no longer needed the listener should be unregistered
        Parameters:
        listener - The listener