methods classes: enable/dissable methods to builder style

This commit is contained in:
Alexander Babai 2016-04-12 23:26:59 +03:00
parent 79616210f4
commit 1232d6f378
11 changed files with 56 additions and 28 deletions

View File

@ -130,12 +130,14 @@ public class SendAudio {
return disableNotification;
}
public void enableNotification() {
public SendAudio enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendAudio disableNotification() {
this.disableNotification = true;
return this;
}
public boolean isNewAudio() {

View File

@ -72,12 +72,14 @@ public class SendContact extends BotApiMethod<Message> {
return disableNotification;
}
public void enableNotification() {
public SendContact enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendContact disableNotification() {
this.disableNotification = true;
return this;
}
public String getPhoneNumber() {

View File

@ -82,12 +82,14 @@ public class SendDocument {
return disableNotification;
}
public void enableNotification() {
public SendDocument enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendDocument disableNotification() {
this.disableNotification = true;
return this;
}
public String getCaption() {

View File

@ -87,12 +87,14 @@ public class SendLocation extends BotApiMethod<Message> {
return disableNotification;
}
public void enableNotification() {
public SendLocation enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendLocation disableNotification() {
this.disableNotification = true;
return this;
}
@Override

View File

@ -89,36 +89,42 @@ public class SendMessage extends BotApiMethod<Message> {
return disableNotification;
}
public void disableWebPagePreview() {
public SendMessage disableWebPagePreview() {
disableWebPagePreview = true;
return this;
}
public void enableWebPagePreview() {
public SendMessage enableWebPagePreview() {
disableWebPagePreview = null;
return this;
}
public void enableNotification() {
public SendMessage enableNotification() {
this.disableNotification = null;
return this;
}
public void disableNotification() {
public SendMessage disableNotification() {
this.disableNotification = true;
return this;
}
public void enableMarkdown(boolean enable) {
public SendMessage enableMarkdown(boolean enable) {
if (enable) {
this.parseMode = ParseMode.MARKDOWN;
} else {
this.parseMode = null;
}
return this;
}
public void enableHtml(boolean enable) {
public SendMessage enableHtml(boolean enable) {
if (enable) {
this.parseMode = ParseMode.HTML;
} else {
this.parseMode = null;
}
return this;
}
@Override

View File

@ -94,12 +94,14 @@ public class SendPhoto {
return disableNotification;
}
public void enableNotification() {
public SendPhoto enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendPhoto disableNotification() {
this.disableNotification = true;
return this;
}
public SendPhoto setNewPhoto(String photo, String photoName) {

View File

@ -81,12 +81,14 @@ public class SendSticker {
return disableNotification;
}
public void enableNotification() {
public SendSticker enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendSticker disableNotification() {
this.disableNotification = true;
return this;
}
public boolean isNewSticker() {

View File

@ -94,12 +94,14 @@ public class SendVenue extends BotApiMethod<Message> {
return disableNotification;
}
public void enableNotification() {
public SendVenue enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendVenue disableNotification() {
this.disableNotification = true;
return this;
}
public String getTitle() {

View File

@ -109,12 +109,14 @@ public class SendVideo {
return disableNotification;
}
public void enableNotification() {
public SendVideo enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendVideo disableNotification() {
this.disableNotification = true;
return this;
}
public Integer getWidth() {

View File

@ -52,12 +52,14 @@ public class SendVoice {
return disableNotification;
}
public void enableNotification() {
public SendVoice enableNotification() {
this.disableNotification = false;
return this;
}
public void disableNotification() {
public SendVoice disableNotification() {
this.disableNotification = true;
return this;
}
public String getChatId() {

View File

@ -105,28 +105,32 @@ public class EditMessageText extends BotApiMethod<Message> {
return this;
}
public void disableWebPagePreview() {
public EditMessageText disableWebPagePreview() {
disableWebPagePreview = true;
return this;
}
public void enableWebPagePreview() {
public EditMessageText enableWebPagePreview() {
disableWebPagePreview = null;
return this;
}
public void enableMarkdown(boolean enable) {
public EditMessageText enableMarkdown(boolean enable) {
if (enable) {
this.parseMode = ParseMode.MARKDOWN;
} else {
this.parseMode = null;
}
return this;
}
public void enableHtml(boolean enable) {
public EditMessageText enableHtml(boolean enable) {
if (enable) {
this.parseMode = ParseMode.HTML;
} else {
this.parseMode = null;
}
return this;
}
@Override