Class ContextDefinition<V>

    • Method Detail

      • name

        public final String name()
        Gets the name for this context definition.
        Returns:
        the definition name
        Since:
        2.0.0
      • serialize

        public abstract String serialize​(V canonicalValue)
        Given a parsed value, write data out as a string.
        Parameters:
        canonicalValue - Parsed value
        Returns:
        serialized form of the value
      • deserialize

        public abstract @Nullable V deserialize​(String userValue)
        Given a string (which may be in user format), return a parsed object.
        Parameters:
        userValue - the value as a string, such as when provided by user input
        Returns:
        V a deserialized value, or null if unsuccessful
      • matches

        public abstract boolean matches​(V ownVal,
                                        V testVal)
      • accumulateCurrentValues

        public abstract void accumulateCurrentValues​(CalculatedSubject subject,
                                                     Consumer<V> consumer)
        Given a player, calculate active context types
        Parameters:
        subject - The subject active contexts are being calculated for
        consumer - A function that will take the returned value and add it to the active context set
      • suggestValues

        public Set<VsuggestValues​(CalculatedSubject subject)
        Given a subject, suggest a set of values that may be valid for this context. This need not be an exhaustive list, or could even be an empty list, but allows providing users possible suggestions to what sensible values for a context may be.