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; return disableNotification;
} }
public void enableNotification() { public SendAudio enableNotification() {
this.disableNotification = false; this.disableNotification = false;
return this;
} }
public void disableNotification() { public SendAudio disableNotification() {
this.disableNotification = true; this.disableNotification = true;
return this;
} }
public boolean isNewAudio() { public boolean isNewAudio() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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