Class TokenStorageQuery.Builder<B extends TokenStorageQuery.Builder<B>>

  • Direct Known Subclasses:
    TokenStorageUserQuery.Builder
    Enclosing class:
    TokenStorageQuery

    public static class TokenStorageQuery.Builder<B extends TokenStorageQuery.Builder<B>>
    extends Object
    A builder class for creating instances of TokenStorageQuery.
    Since:
    2024.07
    • Field Detail

      • myConnectionId

        @Nullable
        protected String myConnectionId
      • myUserId

        @Nullable
        protected Long myUserId
    • Constructor Detail

      • Builder

        protected Builder​(@NotNull
                          SProject project)
    • Method Detail

      • build

        public TokenStorageQuery build()
        Builds a TokenStorageQuery with the specified parameters.
        Returns:
        a TokenStorageQuery
        Since:
        2024.03
      • self

        protected B self()
      • withConnectionId

        public B withConnectionId​(@NotNull
                                  String connectionId)
        Specifies the connection ID to filter tokens by.
        Parameters:
        connectionId - connection ID
        Returns:
        this builder
        Since:
        2024.07
      • withUser

        public B withUser​(@NotNull
                          SUser user)
        Specifies the user for the query. See TokenStorageQuery.myUserId
        Parameters:
        user - the user to be set
        Returns:
        this builder
        Since:
        2024.03
      • withUserId

        public B withUserId​(long userId)
        Specifies the user ID for the query. See TokenStorageQuery.myUserId
        Parameters:
        userId - the user to be set
        Returns:
        this builder
        Since:
        2024.03
      • withRefreshIfNecessary

        public B withRefreshIfNecessary​(boolean refreshIfNecessary)
        Specifies whether found tokens should be refreshed. See TokenStorageQuery.myRefreshIfNecessary
        Parameters:
        refreshIfNecessary - true, if refresh is necessary
        Returns:
        this builder
        Since:
        2024.03
      • withTokenIntent

        public B withTokenIntent​(@NotNull
                                 TokenIntent tokenIntent)
        Specifies the token intent for the query. See TokenStorageQuery.myTokenIntent
        Parameters:
        tokenIntent - the intent to set
        Returns:
        this builder
        Since:
        2024.03
      • withAccessibleEntities

        public B withAccessibleEntities​(@NotNull
                                        Set<String> accessibleEntities)
        Specifies the accessible entities for the query. See TokenStorageQuery.myAccessibleEntities
        Parameters:
        accessibleEntities - the accessible entities to set
        Returns:
        this builder
        Since:
        2024.03
      • withProjectScope

        public B withProjectScope​(@NotNull
                                  Set<SProject> projectScope)
        Specifies the project scope for the query. See TokenStorageQuery.myProjectScope
        Parameters:
        projectScope - the project scope to set
        Returns:
        this builder
        Since:
        2024.03
      • withTokenName

        public B withTokenName​(@NotNull
                               String tokenName)
        Sets the token name to filter by.
        Parameters:
        tokenName - (partial) token name
        Returns:
        this builder
        Since:
        2024.07
        See Also:
        TokenStorageQuery.myTokenName
      • withCustomFilter

        public B withCustomFilter​(@NotNull
                                  Predicate<OAuthToken> customFilter)
        Sets a custom filter to apply when querying the token storage.
        Parameters:
        customFilter - the custom filter
        Returns:
        this builder
        Since:
        2024.07