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 theTokenBuilderimplementation, 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 byTokensubclasses to build token instances. All attributes are required to be set for theTokento 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 Tbuild()Bconsumer(Consumer consumer)Sets theconsumerattribute of the requestTokenobject under construction and returns the next builder in the chain, which allows optional attributes to be set and the final requestTokeninstance to be constructed.Bproperties(Map<String,String> properties)Sets thepropertiesfor the request token and returnsthisbuilder.BtokenSecret(String tokenSecret)Sets thetokenSecretattribute of theTokenunder 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 thetokenSecretattribute of theTokenunder construction and returns this builder to allow for other attributes to be set.- Parameters:
tokenSecret- the secret used by theConsumerto establish ownership of a givenToken- Returns:
- this builder to allow other properties to be set
-
consumer
public final B consumer(Consumer consumer)
Sets theconsumerattribute of the requestTokenobject under construction and returns the next builder in the chain, which allows optional attributes to be set and the final requestTokeninstance to be constructed.- Parameters:
consumer- theConsumerthat owns the token- Returns:
- the next builder in the chain
-
properties
public final B properties(Map<String,String> properties)
Sets thepropertiesfor the request token and returnsthisbuilder.- Parameters:
properties-Map<String, String>of properties to associate with the request token- Returns:
thisbuilder
-
build
public abstract T build()
-
-