Class TagList

java.lang.Object
com.saicone.rtag.tag.TagList

public class TagList extends Object
Class to invoke ListTag methods across versions.
  • Method Details

    • newTag

      public static Object newTag()
      Constructs an empty ListTag.
      Returns:
      New ListTag instance.
    • newTag

      public static <T> Object newTag(List<T> list)
      Constructs an ListTag with provided List of tags.
      Type Parameters:
      T - List type parameter.
      Parameters:
      list - List with Tag values.
      Returns:
      New ListTag instance.
    • newUncheckedTag

      public static <T> Object newUncheckedTag(List<T> list)
      Constructs an ListTag with provided List of tags.
      This method doesn't provide any safe check and assumes that the provided list is completely usable to create a new ListTag.
      Type Parameters:
      T - List type parameter.
      Parameters:
      list - List with Tag values.
      Returns:
      New ListTag instance.
    • newTag

      public static <T> Object newTag(RtagMirror mirror, List<T> list)
      Constructs an ListTag with provided List of any type and required RtagMirror to convert Objects.
      Type Parameters:
      T - List type parameter.
      Parameters:
      mirror - RtagMirror to convert objects into tags.
      list - List with objects.
      Returns:
      New ListTag instance.
    • isTagList

      public static boolean isTagList(Object object)
      Check if the provided object is instance of ListTag class.
      Parameters:
      object - the object to check.
      Returns:
      true if the object is an instance of ListTag class.
    • clone

      public static Object clone(Object tag)
      Copy provided ListTag into new one.
      Parameters:
      tag - ListTag instance.
      Returns:
      A copy of original ListTag.
    • clone

      public static Object clone(Object tag, BiPredicate<Object,Integer> filter)
      Copy provided ListTag into new one using a list filter.
      Parameters:
      tag - ListTag instance.
      filter - Object filter.
      Returns:
      A filtered copy of original ListTag.
    • getValue

      public static List<Object> getValue(Object tag)
      Get current tag list.
      Parameters:
      tag - ListTag instance.
      Returns:
      a list of tags.
    • getValue

      public static List<Object> getValue(RtagMirror mirror, Object tag)
      Get current tag list with values converted.
      Parameters:
      mirror - RtagMirror to convert tags.
      tag - ListTag instance.
      Returns:
      A list of objects.
      See Also:
    • getType

      @Deprecated public static byte getType(Object tag)
      Deprecated.
      Get current tag type that represent tag list.
      Parameters:
      tag - ListTag instance.
      Returns:
      A Tag object type.
      See Also:
    • size

      public static int size(Object tag)
      Get the size of elements inside list.
      Parameters:
      tag - ListTag instance.
      Returns:
      Size of list inside.
    • contains

      public static boolean contains(Object listTag, Object tag)
      Check if current ListTag value contains Tag object.
      Parameters:
      listTag - ListTag instance.
      tag - Tag object.
      Returns:
      true if the list contains the Tag object.
    • add

      public static void add(Object listTag, Object tag)
      Add tag object.
      Parameters:
      listTag - ListTag instance.
      tag - tag object to add.
    • add

      public static void add(Object listTag, Object... tags)
      Add multiple tag objects.
      Parameters:
      listTag - ListTag instance.
      tags - tag objects to add.
    • remove

      public static Object remove(Object tag, int index)
      Remove tag object.
      Parameters:
      tag - ListTag instance.
      index - The index of the tag to be removed
      Returns:
      Removed tag.
    • set

      public static void set(Object listTag, int index, Object tag)
      Set tag object at index.
      Parameters:
      listTag - ListTag instance.
      index - Index of element to replace.
      tag - Tag value to set.
    • setType

      @Deprecated public static void setType(Object tag, byte type)
      Deprecated.
      Change the current Tag type inside ListTag.
      Parameters:
      tag - ListTag instance.
      type - Tag object type.
      See Also:
    • setValue

      public static void setValue(Object tag, List<Object> list)
      Override the current Tag list inside ListTag.
      Parameters:
      tag - ListTag instance.
      list - List with Tag values.
    • get

      public static Object get(Object tag, int index)
      Get tag object from index.
      Parameters:
      tag - ListTag instance.
      index - Index of the tag to return.
      Returns:
      A Tag instance.
    • clear

      public static void clear(Object tag)
      Clear a ListTag and reset list type.
      Parameters:
      tag - ListTag instance.