レベルエンター山本大のブログ

面白いプログラミング教育を若い人たちに

BLOCKVROCKリファレンス目次はこちら

2007-01-01から1年間の記事一覧

Wicket Examples ■Hello World!

WicketのHelloWorldサンプルのチュートリアル HelloWorld demonstrates the basic structure of a web application in Wicket. A Label component is used to display a message on the home page for the application. このHelloWorldはWicketを使ったWebア…

Wicket Examples ■Navomatic

WicketのNavomaticサンプルのチュートリアル オートマティックナビゲーション、ナボマティック ?? Navomatic The Navomatic application shows the use of border components and links to create a navigation component that can easily be dropped into…

Wicket Examples ■GuestBook Application

WicketのGuestBookサンプルのチュートリアル GuestBook The GuestBook application allows users to enter comments that appear on a page like a weblog. Drawing the list of comments is very easy with the Wicket ListView component. This example al…

[翻訳]Guice User's Guide ■16. Implicit Bindings

暗黙的なバインドAs we saw in the introduction, you don't always have to declare bindings explicitly. In the absence of an explicit binding, Guice will try to inject and create a new instance of the class you depend on. If you depend on an …

[翻訳]Guice User's Guide ■17. Injecting Providers

インジェクティング・プロバイダー(注入仲介者)Sometimes a client needs multiple instances of a dependency per injection. Other times a client may not want to actually retrieve an object until some time after the actual injection (if at all…

[翻訳]Guice User's Guide ■18. Injecting Constant Values

定数値のインジェクトWhen it comes to constant values, Guice gives special treatment to several types:定数値が設定されると、Guiceはそれぞれの種類によって固有の処理を行います。 Primitive types (int, char, ...) Primitive wrapper types (Intege…

[翻訳]Guice User's Guide ■19. Converting Strings

文字列の変換If Guice still can't find an explicit binding for one of the above types, it will look for a constant String binding with the same binding annotation and try to convert its value. For example:Guiceが、上記の種類の中でも明示的な…

[翻訳]Guice User's Guide ■20. Custom Providers

カスタムプロバイダーSometimes you need to create your objects manually rather than let Guice create them. For example, you might not be able to add @Inject annotations to the implementation class as it came from a 3rd party. In these cases…

[翻訳]Guice User's Guide ■21. Example: Integrating With JNDI

サンプル:JNDIを使った統合Say for example we want to bind to objects from JNDI. We could implement a reusable custom provider similar to the one below. Notice we inject the JNDI Context:たとえばJNDIに登録されたオブジェクトをバインドしたい…

[翻訳]Guice User's Guide ■22. Scoping Bindings

バインディングの範囲付けBy default, Guice creates a new object for every injection. We refer to this as having "no scope." You can specify a scope when you configure a binding. For example, to inject the same instance every time:デフォルト…

[翻訳]Guice User's Guide ■23. Creating Scope Annotations

スコープアノテーションの作り方Annotations used for scoping should:範囲指定のために使うアノテーションは以下のように作成します。 Have a @Rentention(RUNTIME) annotation so we can see the annotation at runtime. Have a @Target({TYPE}) annotatio…

[翻訳]Guice User's Guide ■24. Eagerly Loading Bindings

熱心なバインディングのロードGuice can wait to load singleton objects until you actually need them. This helps speed up development because your application starts faster and you only initialize what you need. However, sometimes you always …

[翻訳]Guice User's Guide ■25. Injecting Between Scopes

スコープをまたいでインジェクトする場合You can safely inject objects from a larger scope into an object from a smaller scope. For example, you can inject an Http session-scoped object into an HTTP request-scoped object. However, injecting i…

[翻訳]Guice User's Guide ■26. Development Stages

デベロップメントステージ(開発・テスト環境ステージ)Guice is aware that your application goes through different stages of development. You can tell it which stage the application is running in when you create a container. Guice currently s…

[翻訳]Guice User's Guide ■27. Intercepting Methods

メソッドのインターセプトGuice supports simple method interception using the AOP Alliance API. You can bind interceptors from your modules using Binder. For example, to apply a transaction interceptor to methods annotated with @Transactiona…

[翻訳]Guice User's Guide ■28. Static Injection

スタティックStatic変数・メソッドへのインジェクションStatic fields and methods make testing and reusing more difficult, but there are times where your only choice is to keep a static reference to the Injector. スタティックフィールドとメソッ…

[翻訳]Guice User's Guide ■29. Optional Injection

省略可能なインジェクションSometimes your code should work whether a binding exists or not. In these cases, you can use @Inject(optional=true) and Guice can override your default implementation with a bound implementation when available. For…

[翻訳]Guice User's Guide ■30. Binding to Strings

文字列へのバインドWe try to avoid using strings whenever possible as they're prone to misspellings, not tool friendly, and so on, but using strings instead of creating custom annotations can prove useful for quick and dirty code. For these…

[翻訳]Guice User's Guide ■31. Struts 2 Support

Struts 2 サポートTo install the Guice Struts 2 plugin with Struts 2.0.6 or later, simply include guice-struts2-plugin-1.0.jar in your web application's classpath and select Guice as your ObjectFactory implementation in your struts.xml file…

[翻訳]Guice User's Guide ■32. A Counting Example

カウントするサンプルSay for example that we want to count the number of requests in a session. Define a Counter object which will live on the session:例として、セッション中のリクエストの数を数える機能を持ったサンプルを挙げましょう。Session…

[翻訳]Guice User's Guide ■33. JMX Integration

JMXへのインジェクションSee com.google.inject.tools.jmx.APIの「com.google.inject.tools.jmx」を参照してください。

[翻訳]Guice User's Guide ■13. Annotating Bindings

注釈によるバインディングIf you need multiple bindings to the same type, you can differentiate the bindings with annotations. For example, to bind an interface Service and annotation @Blue to the concrete implementation BlueService, call:複…

[翻訳]Guice User's Guide ■12. DRY (Don't Repeat Yourself)

DRY (自分で書いたものを繰り返すな!)Repeating "binder" over and over for each binding can get a little tedious. Guice provides a Module support class named AbstractModule which implicitly gives you access to Binder's methods. For example…

[翻訳]Guice User's Guide ■11. Binding Dependencies

依存性のバインディングHow does Guice know what to inject? For starters, a Key composed of a type and an optional annotation uniquely identifies a dependency. Guice refers to the mapping between a key and an implementation as a Binding. An …

[翻訳]Guice User's Guide ■10. Bootstrapping Your Application

独力で動くアプリケーションThe idea of bootstrapping is fundamental to dependency injection. Always explicitly asking the Injector for dependencies would be using Guice as a service locator, not a dependency injection framework.「独力で動く…

Guice User's Guide ■15. Annotations With Attributes

属性つきのアノテーションIf you can get by with marker annotations alone, feel free to skip to the next section.もし、あなたがマーカーアノテーションだけでやっていくことができるなら、遠慮なく次のセクションまでスキップしてください。You can al…

[翻訳]Guice User's Guide ■14. Creating Binding Annotations

バインディング用のアノテーションを作るWhere did this @Blue annotation just mentioned come from? You can create such an annotation easily, although the standard incantation you have to use is unfortunately a little complex:先ほど話題に出た…

Guice User's Guide ■1. Introduction 

導入The enterprise Java community exerts a lot of effort toward wiring objects together. How does your web application get access to a middle tier service, or your service to the logged in user or transaction manager? You'll find many gene…

Guice User's Guide ■4. Dependency Injection with Guice

Guiceを使ったDependency Injection(依存性の注入)Writing factories and dependency injection logic by hand for every service and client can become tedious. Some other dependency injection frameworks even require you to explicitly map servic…

Guice User's Guide ■3. Dependency Injection By Hand

手作業でのDependency InjectionThe dependency injection pattern aims in part to make unit testing easier. We don't necessarily need a specialized framework to practice dependency injection. You can get roughly 80% of the benefit writing cod…