You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Immutables Java annotation processors to generate simple, safe and consistent value objects. Do not repeat yourself, try Immutables, the most comprehensive tool in this field! Get started! Read guide... v2.10.1 import org.immutables.value.Value; // Define abstract value type @Value.Immutable public interface ValueObject { String name(); List<Integer> counts(); Optional<String> description(); } //
1. © 2013 EIICHI KIMURA. All Rights Reserved. 1 JJUG CCC 2013 Spring - [R5-3] #ccc_r53 Type Annotationって何 ? それを使うとプログラムはどう変わる ? 2013/5/11 木村英一(@kimuchi583) 2013/5/11 15:15-16:05 2. 某メーカー/SIer で Java 技術支援や、新機能をいち早く普 及展開することに精力を注いでいます。ただ、イマイチ、新し いバージョンに移ってくれないのが悩みのタネ。Java との出会 いは v1.02 の頃。あれよ、あれよという間に 17年もってしまいま した。乗り鉄 & 撮り鉄。 WebSite(1) ー "Java etc..." - http://kimuchi583.at.webry.info/ WebSIte(2) ー
タイプアノテーション これまでアノテーションはクラスやメソッドの宣言に対してのみ付与することが可能だったが、Java 8からは変数の型やジェネリクスの型パラメータに対しても付与することができるようになった。この機能は「タイプアノテーション」と呼ばれる。 タイプアノテーションの利用例としてはChecker Frameworkがある。これはコードの様々な個所にアノテーションを付与しておくことでコンパイラだけでは不可能な高度な型チェックを行うことができるというものだ(コマンドラインからの実行に加え、EclipseやIntelliJ用のプラグインも用意されている)。 例えば以下のコードはgetObject()メソッドが常にnullを返すため、実行すると最後の行でNullPointerExceptionが発生する。 Object getObject() { return null; } @NotNu
Its main purpose is compile-time, annotation-driven source code generation in a declarative and customizable fashion. JAnnocessor is built on top of Javascript APT, encapsulating the Java source code model in a rich and convenient high-level domain model that serves as a good target for expressive matching and transformation. Finally, a template engine is used for customizable template-based sourc
FindBugs の @NonNull アノテーションで引数や戻り値が null でないことを明示すると、可読性もよくなるし、間違って null の引数を指定したり、null を返すコードを書くと、FindBugs の指摘が入るので、不要な null チェックの冗長なコードが減少する。 import edu.umd.cs.findbugs.annotations.NonNull; .. @NonNull public String get(@NonNull String key) { .. return .. } .. 逆に、どうしても null の引数指定や null の戻り値が発生する場合は @CheckForNull アノテーションを付けて null チェックコードを書くように明示することができる。こちらは null チェックがないと FindBugs が指摘してくれる。 impor
Eclipse Junoでnull解析を行う Eclipse Juno(4.2)から、@Nullableが付いたパラメータを、そのメソッド内でNullチェックしていない場合はwarningやerrorにすることが出来るようになります。 @Nullable Nullableアノテーションがついているパラメータは、そのパラメータにはNullが渡されることも許容するという意味になります。 なので、メソッド内で値のNullチェックを行う必要があります。 例えば、以下のようなコードを書いたとします。 import static org.junit.Assert.assertEquals; import javax.annotation.Nullable; import org.junit.Test; public class NullableTest { @Test public void test
Precondition checking like null-checking is very important element for program, but sometimes it becomes boring because it's a defensive technique and far apart from our purpose -- hacking. nullチェックのような前提条件確認はプログラムにおいて非常に大切な要素ではありますが、防御的であり目的を実現するためのコードではないため、時につまらない作業になりがちです。 public MyClass(String name) { if (name == null) { throw new IllegalArgumentException(); } this.name = name; } Yes, I know
Update: Video available from Oredev: vimeo.com/53147485 Metaprogramming is the dirty little secret behind the success of many Java frameworks such as Spring and Struts2, and constitutes the backbone of many of the most fundamental APIs across the JEE technology stack. This session aims introduce the topic and highlight, with code examples, the different mechanisms and techniques to take advantage
Java, Advent Calendarこの記事は Java Advent Calendar 2011 の一環で書いてます。詳細はこちらを参照してください。昨日の id:ttmmrr さんの記事はこちら (2012年の公休日とか)JTableのフィルタリング - ttmmrr(@o_tmr)の日記たまたま、いま作ってるプログラムで、Javaプログラマに役立ちそうな部分があったので、その部分を抜き出して公開することにしました。今回はその紹介をしようと思います。 「インタフェースこそが型である」世界Java: The Good Parts という本がありまして、その3章において、(私の理解としては)Javaにおいて、型とはインタフェースのことあり、クラスは型に実装を提供するものであり、すべてのクラスはインタフェースを備えるべきだ、とかいう意味の論が展開されてます。インタフェースはクラスから型
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く