Record Class RelationalPlaceholder<A extends Audience>

java.lang.Object
java.lang.Record
io.github.miniplaceholders.api.placeholder.RelationalPlaceholder<A>
Type Parameters:
A - the audience type, if not specified, will be a generic Audience
Record Components:
targetClass - the target class, can be null
key - the key of the entire placeholder
name - the name of this placeholder
resolver - the relational resolver, in charge of obtaining data based on a relationship of 2 audiences
All Implemented Interfaces:
Placeholder, TagResolver

@NullMarked public record RelationalPlaceholder<A extends Audience>(@Nullable Class<A extends Audience> targetClass, String key, String name, RelationalTagResolver<A extends Audience> resolver) extends Record implements Placeholder
Relational Placeholder.
This placeholder is able to obtain data based on a relationship between 2 audiences using a type-safe filter and a relational resolver.
See Also:
API Note:
The key() method returns the full name of the placeholder, for example, if the placeholder is <server_name>, the key() method will return server_name.
  • Constructor Details

    • RelationalPlaceholder

      public RelationalPlaceholder(@Nullable @Nullable Class<A> targetClass, @TagPattern String key, String name, RelationalTagResolver<A> resolver)
      Creates an instance of a RelationalPlaceholder record class.
      Parameters:
      targetClass - the value for the targetClass record component
      key - the value for the key record component
      name - the value for the name record component
      resolver - the value for the resolver record component
  • Method Details

    • relational

      public static <A extends Audience> RelationalPlaceholder<A> relational(@Nullable @Nullable Class<A> targetClass, @TagPattern String key, String name, RelationalTagResolver<A> resolver)
      Static method capable of creating an instance of a relational placeholder.
      Type Parameters:
      A - the audience type, if not specified, will be a generic Audience
      Parameters:
      targetClass - the target class, can be null
      key - the key of the entire placeholder
      name - the name of this placeholder
      resolver - the relational resolver, in charge of obtaining data based on a relationship of 2 audiences
      Returns:
      a new RelationalPlaceholder
      Since:
      3.0.0
    • resolve

      @Nullable public @Nullable Tag resolve(String name, ArgumentQueue arguments, Context ctx)
      Specified by:
      resolve in interface TagResolver
    • has

      public boolean has(@NotNull @NotNull String name)
      Specified by:
      has in interface TagResolver
    • equals

      public 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • hashCode

      public 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
    • toString

      public 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
    • targetClass

      @Nullable public @Nullable Class<A> targetClass()
      Returns the value of the targetClass record component.
      Returns:
      the value of the targetClass record component
    • key

      @TagPattern public String key()
      Returns the value of the key record component.
      Specified by:
      key in interface Placeholder
      Returns:
      the value of the key record component
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface Placeholder
      Returns:
      the value of the name record component
    • resolver

      public RelationalTagResolver<A> resolver()
      Returns the value of the resolver record component.
      Returns:
      the value of the resolver record component