Class GameObjectText

  • All Implemented Interfaces:
    java.io.Serializable

    public class GameObjectText
    extends java.lang.Object
    implements java.io.Serializable
    A set of key/value attributes.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addObjectText​(@NotNull java.lang.String line, @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
      Appends a line to the object text.
      boolean equals​(@Nullable java.lang.Object obj)  
      @NotNull java.util.Collection<java.lang.String> getAttributeKeys()
      Returns all attribute keys of this object.
      @Nullable java.lang.String getAttributeValue​(@NotNull java.lang.String attributeName)
      Returns an attribute value by attribute name.
      @NotNull java.lang.String getObjectText()
      Returns the object text.
      int hashCode()  
      boolean hasObjectText()
      Returns whether an object text is set.
      boolean removeAttribute​(@NotNull java.lang.String attributeName, @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
      Removes an attribute.
      boolean setAttributeValue​(@NotNull java.lang.String attributeName, boolean sameAsInArchetype, @NotNull java.lang.String value, @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
      Updates an attribute's value.
      boolean setObjectText​(@NotNull java.lang.String objectText, @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
      Sets the object text.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GameObjectText

        public GameObjectText()
        Creates a new instance.
      • GameObjectText

        public GameObjectText​(@NotNull
                              @NotNull GameObjectText gameObjectText)
        Creates a new instance as a copy of another instance.
        Parameters:
        gameObjectText - the other instance
    • Method Detail

      • getAttributeValue

        @Nullable
        public @Nullable java.lang.String getAttributeValue​(@NotNull
                                                            @NotNull java.lang.String attributeName)
        Returns an attribute value by attribute name.
        Parameters:
        attributeName - the attribute name
        Returns:
        the attribute value or null
      • getObjectText

        @NotNull
        public @NotNull java.lang.String getObjectText()
        Returns the object text.
        Returns:
        the object text
      • hasObjectText

        public boolean hasObjectText()
        Returns whether an object text is set.
        Returns:
        whether an object text is set
      • addObjectText

        public boolean addObjectText​(@NotNull
                                     @NotNull java.lang.String line,
                                     @NotNull
                                     @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
        Appends a line to the object text.
        Parameters:
        line - the line to append, may contain '\n' for appending multiple lines
        baseObject - the game object to notify of changes
        Returns:
        whether the object text was changed
      • setObjectText

        public boolean setObjectText​(@NotNull
                                     @NotNull java.lang.String objectText,
                                     @NotNull
                                     @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
        Sets the object text.
        Parameters:
        objectText - the object text to set
        baseObject - the game object to notify of changes
        Returns:
        whether the object text was changed
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(@Nullable
                              @Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • removeAttribute

        public boolean removeAttribute​(@NotNull
                                       @NotNull java.lang.String attributeName,
                                       @NotNull
                                       @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
        Removes an attribute.
        Parameters:
        attributeName - the attribute name
        baseObject - the game object to notify of changes
        Returns:
        whether the object text has changed
      • setAttributeValue

        public boolean setAttributeValue​(@NotNull
                                         @NotNull java.lang.String attributeName,
                                         boolean sameAsInArchetype,
                                         @NotNull
                                         @NotNull java.lang.String value,
                                         @NotNull
                                         @NotNull AbstractBaseObject<?,​?,​?,​?> baseObject)
        Updates an attribute's value.
        Parameters:
        attributeName - the attribute name
        sameAsInArchetype - whether the new value is the same as in the archetype
        value - the new value
        baseObject - the game object to notify of changes
        Returns:
        whether the object text has changed
      • getAttributeKeys

        @NotNull
        public @NotNull java.util.Collection<java.lang.String> getAttributeKeys()
        Returns all attribute keys of this object.
        Returns:
        the attribute keys