This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 68105d9bcc59721445d9a0243132700fd59e60d9 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Tue Jan 27 05:52:59 2026 +0000 (chores): modernize instanceof checks in camel-telegram --- .../apache/camel/component/telegram/model/PaidMedia.java | 6 +++--- .../telegram/model/payments/RevenueWithdrawalState.java | 6 +++--- .../telegram/model/payments/TransactionPartner.java | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java index 015cdcc6512d..a9208394642a 100644 --- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/PaidMedia.java @@ -64,20 +64,20 @@ public abstract class PaidMedia implements Serializable { * Returns this object as {@link PaidMediaPreview} if it is of that type, null otherwise. */ public PaidMediaPreview asPreview() { - return this instanceof PaidMediaPreview ? (PaidMediaPreview) this : null; + return this instanceof PaidMediaPreview preview ? preview : null; } /** * Returns this object as {@link PaidMediaPhoto} if it is of that type, null otherwise. */ public PaidMediaPhoto asPhoto() { - return this instanceof PaidMediaPhoto ? (PaidMediaPhoto) this : null; + return this instanceof PaidMediaPhoto photo ? photo : null; } /** * Returns this object as {@link PaidMediaVideo} if it is of that type, null otherwise. */ public PaidMediaVideo asVideo() { - return this instanceof PaidMediaVideo ? (PaidMediaVideo) this : null; + return this instanceof PaidMediaVideo video ? video : null; } } diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java index b7d75c4a2813..819d067b6dd5 100644 --- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/RevenueWithdrawalState.java @@ -66,20 +66,20 @@ public abstract class RevenueWithdrawalState implements Serializable { * Returns this object as {@link RevenueWithdrawalStatePending} if it is of that type, null otherwise. */ public RevenueWithdrawalStatePending asPending() { - return this instanceof RevenueWithdrawalStatePending ? (RevenueWithdrawalStatePending) this : null; + return this instanceof RevenueWithdrawalStatePending pending ? pending : null; } /** * Returns this object as {@link RevenueWithdrawalStateSucceeded} if it is of that type, null otherwise. */ public RevenueWithdrawalStateSucceeded asSucceeded() { - return this instanceof RevenueWithdrawalStateSucceeded ? (RevenueWithdrawalStateSucceeded) this : null; + return this instanceof RevenueWithdrawalStateSucceeded succeeded ? succeeded : null; } /** * Returns this object as {@link RevenueWithdrawalStateFailed} if it is of that type, null otherwise. */ public RevenueWithdrawalStateFailed asFailed() { - return this instanceof RevenueWithdrawalStateFailed ? (RevenueWithdrawalStateFailed) this : null; + return this instanceof RevenueWithdrawalStateFailed failed ? failed : null; } } diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java index fa51bb71762c..2dd0aae4150e 100644 --- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/payments/TransactionPartner.java @@ -69,48 +69,48 @@ public abstract class TransactionPartner implements Serializable { * Returns this object as {@link TransactionPartnerUser} if it is of that type, null otherwise. */ public TransactionPartnerUser asUser() { - return this instanceof TransactionPartnerUser ? (TransactionPartnerUser) this : null; + return this instanceof TransactionPartnerUser user ? user : null; } /** * Returns this object as {@link TransactionPartnerChat} if it is of that type, null otherwise. */ public TransactionPartnerChat asChat() { - return this instanceof TransactionPartnerChat ? (TransactionPartnerChat) this : null; + return this instanceof TransactionPartnerChat chat ? chat : null; } /** * Returns this object as {@link TransactionPartnerAffiliateProgram} if it is of that type, null otherwise. */ public TransactionPartnerAffiliateProgram asAffiliateProgram() { - return this instanceof TransactionPartnerAffiliateProgram ? (TransactionPartnerAffiliateProgram) this : null; + return this instanceof TransactionPartnerAffiliateProgram affiliateProgram ? affiliateProgram : null; } /** * Returns this object as {@link TransactionPartnerFragment} if it is of that type, null otherwise. */ public TransactionPartnerFragment asFragment() { - return this instanceof TransactionPartnerFragment ? (TransactionPartnerFragment) this : null; + return this instanceof TransactionPartnerFragment fragment ? fragment : null; } /** * Returns this object as {@link TransactionPartnerTelegramAds} if it is of that type, null otherwise. */ public TransactionPartnerTelegramAds asTelegramAds() { - return this instanceof TransactionPartnerTelegramAds ? (TransactionPartnerTelegramAds) this : null; + return this instanceof TransactionPartnerTelegramAds telegramAds ? telegramAds : null; } /** * Returns this object as {@link TransactionPartnerTelegramApi} if it is of that type, null otherwise. */ public TransactionPartnerTelegramApi asTelegramApi() { - return this instanceof TransactionPartnerTelegramApi ? (TransactionPartnerTelegramApi) this : null; + return this instanceof TransactionPartnerTelegramApi telegramApi ? telegramApi : null; } /** * Returns this object as {@link TransactionPartnerOther} if it is of that type, null otherwise. */ public TransactionPartnerOther asOther() { - return this instanceof TransactionPartnerOther ? (TransactionPartnerOther) this : null; + return this instanceof TransactionPartnerOther other ? other : null; } }
