Sealed classes and Interfaces in Java 15 در جاوا
Ramin Zare
در جاوا 15 ویژگی جدیدی به شکل preview معرفی شده به نام sealed classes. یکی از مشکلاتی که توی تعریف کلاس های جاوایی وجود داشت این بود که به شما اجازه نمیداد که یک دامنه خاص از کلاس ها را تعریف کنید و فرض اولیه این بود که همه ی کد ها قراره استفاده مجدد بشن. با این قابلیت میتونید ارث بری از کلاس والد را برای تعداد خاصی از کلاس های فرزند مقطوع کنید.
https://openjdk.java.net/jeps/397
نمونه کد https://github.com/zare88/interpreter_with_sealed_classes_in_java
ویدیوی آشنایی با JPMS https://youtu.be/IM-wc6PM8fM
ویدیوی آشنایی با رکورد ها در جاوا https://youtu.be/QjsrYbesunw
ویدیوی آشنایی با pattern matching for instance of در جاوا https://youtu.be/hVzZGWe2yF4
الگوی طراحی interpreter https://youtu.be/zbzSWenwWqU
Timeline:
00:00 شروع 00:25 معرفی ویژگی 01:14 مشکل ارث بری کلاس ها خارج از یک دامنه 04:22 Sealed clas or interface نمونه کد 09:36 قوانین Sealed classes کلید واژه های جدید sealed , non-sealed , permits 12:12 انواع تعریف sealed class ها 12:30 Sealed classes and record classes 13:08 Sealed classes and pattern matching 14:19 نمونه کد در یک پروژه 19:43 توضیحی راجع به ادامه روند کانال و پایان
من را در شبکه های اجتماعی دنبال کنید:
Youtube: https://youtube.com/RaminZare Instagram: https://www.instagram.com/codingwithramin Telegram: https://t.me/raminzare_ch Twitter: https://twitter.com/zare88r Compile Podcast: https://pod.link/1449983133
#java #java15 #جاوا ... https://www.youtube.com/watch?v=EpJrVu-WHyE
148704332 Bytes