Class Token.TokenBuilder<T,B extends Token.TokenBuilder<T,B>>
- java.lang.Object
-
- com.atlassian.bitbucket.jenkins.internal.applink.oauth.Token.TokenBuilder<T,B>
-
- Type Parameters:
T
- type of the token being constructedB
- type of theTokenBuilder
implementation, so that the attribute setting methods can return objects of the type of the subclassed builder in case additional properties are added and need to be set
- Direct Known Subclasses:
ServiceProviderToken.ServiceProviderTokenBuilder
- Enclosing class:
- Token
public abstract static class Token.TokenBuilder<T,B extends Token.TokenBuilder<T,B>> extends Object
Base builder that can be used byToken
subclasses to build token instances. All attributes are required to be set for theToken
to be constructed properly.
-
-
Constructor Summary
Constructors Constructor Description TokenBuilder(Token.Type type, String token)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
build()
B
consumer(Consumer consumer)
Sets theconsumer
attribute of the requestToken
object under construction and returns the next builder in the chain, which allows optional attributes to be set and the final requestToken
instance to be constructed.B
properties(Map<String,String> properties)
Sets theproperties
for the request token and returnsthis
builder.B
tokenSecret(String tokenSecret)
Sets thetokenSecret
attribute of theToken
under construction and returns this builder to allow for other attributes to be set.
-
-
-
Constructor Detail
-
TokenBuilder
public TokenBuilder(Token.Type type, String token)
-
-
Method Detail
-
tokenSecret
public final B tokenSecret(String tokenSecret)
Sets thetokenSecret
attribute of theToken
under construction and returns this builder to allow for other attributes to be set.- Parameters:
tokenSecret
- the secret used by theConsumer
to establish ownership of a givenToken
- Returns:
- this builder to allow other properties to be set
-
consumer
public final B consumer(Consumer consumer)
Sets theconsumer
attribute of the requestToken
object under construction and returns the next builder in the chain, which allows optional attributes to be set and the final requestToken
instance to be constructed.- Parameters:
consumer
- theConsumer
that owns the token- Returns:
- the next builder in the chain
-
properties
public final B properties(Map<String,String> properties)
Sets theproperties
for the request token and returnsthis
builder.- Parameters:
properties
-Map<String, String>
of properties to associate with the request token- Returns:
this
builder
-
build
public abstract T build()
-
-