Class ChangeDescription


  • public final class ChangeDescription
    extends java.lang.Object
    This class is used to describe the changes that need to be performed over a particular property.
    Since:
    TDI 7.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int TYPE_ADD
      Specifies that the property should be added.
      static int TYPE_COMMENT
      Specifies that the property should be commented.
      static int TYPE_DELETE
      Specifies that the property should be deleted.
      static int TYPE_MODIFY
      Specifies that the property should be modified.
      static int TYPE_UNCOMMENT
      Specifies that the property should be uncommented.
    • Constructor Summary

      Constructors 
      Constructor Description
      ChangeDescription​(java.lang.String propertyKey, int type)
      Constructs an instance by providing the type of change only.
      ChangeDescription​(java.lang.String propertyKey, int type, boolean deleteCommentsBefore)
      Constructs an instance by providing the type of change.
      ChangeDescription​(java.lang.String propertyKey, int type, java.lang.String value)
      Constructs an instance by providing the type of change.
      ChangeDescription​(java.lang.String propertyKey, int type, java.lang.String value, java.lang.String addAfterKey)
      Constructs an instance by providing the type of change.
      ChangeDescription​(java.lang.String propertyKey, int type, java.lang.String value, java.lang.String addAfterKey, java.lang.String[] addCommentLines, int addNewLinesBefore, int addNewLinesAfter)
      Constructs an instance by providing the type of change.
    • Field Detail

      • TYPE_COMMENT

        public static final int TYPE_COMMENT
        Specifies that the property should be commented.
        See Also:
        Constant Field Values
      • TYPE_UNCOMMENT

        public static final int TYPE_UNCOMMENT
        Specifies that the property should be uncommented.
        See Also:
        Constant Field Values
      • TYPE_ADD

        public static final int TYPE_ADD
        Specifies that the property should be added.
        See Also:
        Constant Field Values
      • TYPE_MODIFY

        public static final int TYPE_MODIFY
        Specifies that the property should be modified.
        See Also:
        Constant Field Values
      • TYPE_DELETE

        public static final int TYPE_DELETE
        Specifies that the property should be deleted.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ChangeDescription

        public ChangeDescription​(java.lang.String propertyKey,
                                 int type)
        Constructs an instance by providing the type of change only. This is useful for changes that don't need value operand - TYPE_COMMENT, TYPE_UNCOMMENT, TYPE_DELETE.
        Parameters:
        type - the type of change to create. The changes could be logically OR'd to build a complex type of change.
      • ChangeDescription

        public ChangeDescription​(java.lang.String propertyKey,
                                 int type,
                                 java.lang.String value)
        Constructs an instance by providing the type of change. This is useful for changes that don't need any other operands but a value - TYPE_ADD, TYPE_MODIFY. It could also be used with null for the following changes - TYPE_COMMENT, TYPE_UNCOMMENT, TYPE_DELETE
        Parameters:
        type - the type of change to create. The changes could be logically OR'd to build a complex type of change.
        value - the value of the added/modified property or null
      • ChangeDescription

        public ChangeDescription​(java.lang.String propertyKey,
                                 int type,
                                 java.lang.String value,
                                 java.lang.String addAfterKey)
        Constructs an instance by providing the type of change. This is useful for changes describing addition of a property - TYPE_ADD. It could also be used with nullified values for the following changes - TYPE_COMMENT, TYPE_UNCOMMENT, TYPE_DELETE, TYPE_MODIFY
        Parameters:
        type - the type of change to create. The changes could be logically OR'd to build a complex type of change.
        value - the value of the added/modified property or null
        addAfterKey - specifies the name of the key to add this property after. May be null
        addCommentLines - specifies an array of lines of comments to add before this property. Each string will be commented and put on a separate line in the output configuration file. May be null
        addNewLinesBefore - specifies the number of lines to add before the property (or the comments if there are some)
        addNewLinesAfter - specifies the number of lines to add after the property
      • ChangeDescription

        public ChangeDescription​(java.lang.String propertyKey,
                                 int type,
                                 java.lang.String value,
                                 java.lang.String addAfterKey,
                                 java.lang.String[] addCommentLines,
                                 int addNewLinesBefore,
                                 int addNewLinesAfter)
        Constructs an instance by providing the type of change. This is useful for changes describing addition of a property - TYPE_ADD. It could also be used with nullified values for the following changes - TYPE_COMMENT, TYPE_UNCOMMENT, TYPE_DELETE, TYPE_MODIFY
        Parameters:
        type - the type of change to create. The changes could be logically OR'd to build a complex type of change.
        value - the value of the added/modified property or null
        addAfterKey - specifies the name of the key to add this property after. May be null
      • ChangeDescription

        public ChangeDescription​(java.lang.String propertyKey,
                                 int type,
                                 boolean deleteCommentsBefore)
        Constructs an instance by providing the type of change. This is useful for changes describing deletion of a property - TYPE_DELETE.
        Parameters:
        type - the type of change to create. The changes could be logically OR'd to build a complex type of change.
        deleteCommentsBefore - specifies whether the comments right before the property should be deleted.
    • Method Detail

      • getPropertyKey

        public java.lang.String getPropertyKey()
        Returns:
        the key name of the property that will be changed.
      • isAdded

        public boolean isAdded()
        Answers true if the change type contains TYPE_ADD
        Returns:
        true if TYPE_ADD is present, false otherwise.
      • isModifyed

        public boolean isModifyed()
        Answers true if the change type contains TYPE_MODIFY
        Returns:
        true if TYPE_MODIFY is present, false otherwise.
      • isDeleted

        public boolean isDeleted()
        Answers true if the change type contains TYPE_DELETE
        Returns:
        true if TYPE_DELETE is present, false otherwise.
      • isCommented

        public boolean isCommented()
        Answers true if the change type contains TYPE_COMMENT
        Returns:
        true if TYPE_COMMENT is present, false otherwise.
      • isUncommented

        public boolean isUncommented()
        Answers true if the change type contains TYPE_UNCOMMENT
        Returns:
        true if TYPE_UNCOMMENT is present, false otherwise.
      • getValue

        public java.lang.String getValue()
        Returns:
        the value of the new property to add/modify
      • getAddAfterKey

        public java.lang.String getAddAfterKey()
        Returns:
        the key name of the property to add this after
      • isDeletingComments

        public boolean isDeletingComments()
        Returns:
        true if the interpreter should delete the comments before this property.
      • getAddComment

        public java.util.List<java.lang.String> getAddComment()
        Returns:
        the strings of the block of comments to put before this property.
      • getAddNewLinesBefore

        protected int getAddNewLinesBefore()
        Returns:
        the number of End-Of-Lines characters to put before this property.
      • getAddNewLinesAfter

        protected int getAddNewLinesAfter()
        Returns:
        the number of End-Of-Lines characters to put after this property.