LanternaBuilderModule.java
01 /*
02  * SPDX-License-Identifier: Apache-2.0
03  *
04  * Copyright 2008-2018 the original author or authors.
05  *
06  * Licensed under the Apache License, Version 2.0 (the "License");
07  * you may not use this file except in compliance with the License.
08  * You may obtain a copy of the License at
09  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 package org.codehaus.griffon.runtime.lanterna;
19 
20 import griffon.builder.lanterna.LanternaBuilderCustomizer;
21 import griffon.core.injection.Module;
22 import griffon.inject.DependsOn;
23 import griffon.lanterna.LanternaWindowDisplayHandler;
24 import griffon.util.BuilderCustomizer;
25 import org.codehaus.griffon.runtime.core.injection.AbstractModule;
26 import org.kordamp.jipsy.ServiceProviderFor;
27 
28 import javax.inject.Named;
29 
30 import static griffon.util.AnnotationUtils.named;
31 
32 /**
33  @author Andres Almiray
34  */
35 @ServiceProviderFor(Module.class)
36 @DependsOn("lanterna")
37 @Named("lanterna-groovy")
38 public class LanternaBuilderModule extends AbstractModule {
39     @Override
40     protected void doConfigure() {
41         // tag::bindings[]
42         bind(BuilderCustomizer.class)
43             .to(LanternaBuilderCustomizer.class)
44             .asSingleton();
45         bind(LanternaWindowDisplayHandler.class)
46             .withClassifier(named("windowDisplayHandler"))
47             .to(GroovyAwareConfigurableLanternaWindowDisplayHandler.class)
48             .asSingleton();
49         // end::bindings[]
50     }
51 }