Class Entry.AbstractEntryBuilder<T>

java.lang.Object
com.sshtools.common.sshd.config.Entry.AbstractEntryBuilder<T>
Direct Known Subclasses:
MatchEntry.MatchEntryBuilder, SshdConfigFile.SshdConfigFileBuilder
Enclosing class:
Entry

public abstract static class Entry.AbstractEntryBuilder<T> extends Object
  • Field Details

  • Constructor Details

    • AbstractEntryBuilder

      public AbstractEntryBuilder()
  • Method Details

    • getManagedInstance

      protected abstract Entry getManagedInstance()
    • updateEntry

      public T updateEntry(String key, String value)
      Will update the value for the given key with new entry.
      Parameters:
      key -
      entry -
      Returns:
    • deleteEntry

      public T deleteEntry(String key)
      Will delete the entry for the given key.
      Parameters:
      key -
      Returns:
    • addComment

      public T addComment(String comment)
      Will add a comment entry at current location.
      Parameters:
      commentEntry -
      Returns:
    • addCommentForEntry

      public T addCommentForEntry(String key, String comment)
      Will add a comment entry before the entry with the given key. Note: Multiple calls will add calls in reverse.
              addCommentForEntry(....1)
        addCommentForEntry(....2)
        addCommentForEntry(....3)
       
      Above will end up as first 3, then 2 finally 1. All entries are made at index at which the entry is found.
      Parameters:
      comment -
    • addCommentForEntry

      public T addCommentForEntry(String key, CommentEntry commentEntry)
      Will add a comment entry before the entry with the given key. Note: Multiple calls will add calls in reverse.
              addCommentForEntry(....1)
        addCommentForEntry(....2)
        addCommentForEntry(....3)
       
      Above will end up as first 3, then 2 finally 1. All entries are made at index at which the entry is found.
      Parameters:
      commentEntry -
    • addBeginingComment

      public T addBeginingComment(CommentEntry commentEntry)
      Will add a comment entry at the beginning of the section. Note: Multiple calls will add calls in reverse.
              addBeginingComment(....1)
        addBeginingComment(....2)
        addBeginingComment(....3)
       
      Above will end up as first 3, then 2 finally 1. All entries are made at index 0.
      Parameters:
      commentEntry -
    • addEntry

      public T addEntry(SshdConfigFileEntry sshdConfigFileEntry)
      Will add entry after last non blank, non comment entry in a section (Global, Match) Note: Use while operating on file after loading it.
      Parameters:
      sshdConfigFileEntry -
      Returns:
    • appendEntry

      public T appendEntry(SshdConfigFileEntry sshdConfigFileEntry)
      Will add entry to the end of section. Note: Use while writing a file.
      Parameters:
      sshdConfigFileEntry -
      Returns:
    • findEntry

      public SshdConfigFileEntry findEntry(String key)
    • findEntry

    • entryMatches

      public T entryMatches(String key, Collection<String> patterns, Entry.AbstractEntryBuilder.Result<Boolean> result)
    • entryMatches

      public Boolean entryMatches(String key, Collection<String> patterns)
    • findEntryIndex

      public int findEntryIndex(String key)
    • findEntryAtIndex

      public SshdConfigFileEntry findEntryAtIndex(int index)
    • findEntryIndex

      public T findEntryIndex(String key, Entry.AbstractEntryBuilder.Result<Integer> result)
    • findEntryToEdit

      public T findEntryToEdit(String key)
    • resetPointer

      public T resetPointer()
    • cursor

      public SshdConfigFileCursor cursor()