public abstract class ObjectBuilder extends Object
CommitBuilder
and TagBuilder
.Constructor and Description |
---|
ObjectBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract byte[] |
build()
Format this builder's state as a git object.
|
protected PersonIdent |
getAuthor()
Retrieves the author of this object.
|
Charset |
getEncoding()
Retrieves the encoding that should be used for the message text.
|
GpgSignature |
getGpgSignature()
Retrieves the GPG signature of this object.
|
String |
getMessage()
Retrieves the complete message of the object.
|
protected void |
setAuthor(PersonIdent newAuthor)
Sets the author (name, email address, and date) of this object.
|
void |
setEncoding(Charset encoding)
Sets the encoding for the object message.
|
void |
setGpgSignature(GpgSignature gpgSignature)
Sets the GPG signature of this object.
|
void |
setMessage(String message)
Sets the message (commit message, or message of an annotated tag).
|
protected PersonIdent getAuthor()
null
if not set yetprotected void setAuthor(PersonIdent newAuthor)
newAuthor
- the new author, must be non-null
public void setGpgSignature(@Nullable GpgSignature gpgSignature)
Note, the signature set here will change the payload of the object, i.e.
the output of build()
will include the signature. Thus, the
typical flow will be:
build()
without a signature set to obtain payloadGpgSignature
from payloadGpgSignature
gpgSignature
- the signature to set or null
to unset@Nullable public GpgSignature getGpgSignature()
null
if the object
is not signed@Nullable public String getMessage()
null
.public void setMessage(@Nullable String message)
message
- the message.@NonNull public Charset getEncoding()
public void setEncoding(@NonNull Charset encoding)
encoding
- the encoding to use.@NonNull public abstract byte[] build() throws UnsupportedEncodingException
UnsupportedEncodingException
- the encoding specified by getEncoding()
is not
supported by this Java runtime.Copyright © 2021 Eclipse JGit Project. All rights reserved.