| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 Google Inc. | 2 * Copyright 2008 Google Inc. |
| 3 * | 3 * |
| 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not | 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| 5 * use this file except in compliance with the License. You may obtain a copy of | 5 * use this file except in compliance with the License. You may obtain a copy of |
| 6 * the License at | 6 * the License at |
| 7 * | 7 * |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 * | 9 * |
| 10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Guice does not support byte constants. | 26 // Guice does not support byte constants. |
| 27 /*public static final byte ID = 0x41;*/ | 27 /*public static final byte ID = 0x41;*/ |
| 28 public static final char INITIAL = 'a'; | 28 public static final char INITIAL = 'a'; |
| 29 public static final double VOLUME = 20.2; | 29 public static final double VOLUME = 20.2; |
| 30 public static final float WEIGHT = 200.5f; | 30 public static final float WEIGHT = 200.5f; |
| 31 public static final int SEEDS = 4; | 31 public static final int SEEDS = 4; |
| 32 public static final long WORMS = 1; | 32 public static final long WORMS = 1; |
| 33 public static final short LEAVES = 2; | 33 public static final short LEAVES = 2; |
| 34 public static final String NAME = "Apple"; | 34 public static final String NAME = "Apple"; |
| 35 public static final Color COLOR = Color.Red; | 35 public static final Color COLOR = Color.Red; |
| 36 public static final Color ALTERNATIVE_COLOR = Color.Yellow; |
| 37 public static final Fruit.Family FAMILY = Fruit.Family.Rosaceae; |
| 36 | 38 |
| 37 protected void configure() { | 39 protected void configure() { |
| 38 bindConstant().annotatedWith(Names.named("eaten")).to(EATEN); | 40 bindConstant().annotatedWith(Names.named("eaten")).to(EATEN); |
| 39 /*bindConstant().annotatedWith(Names.named("id")).to(ID);*/ | 41 /*bindConstant().annotatedWith(Names.named("id")).to(ID);*/ |
| 40 bindConstant().annotatedWith(Names.named("initial")).to(INITIAL); | 42 bindConstant().annotatedWith(Names.named("initial")).to(INITIAL); |
| 41 bindConstant().annotatedWith(Names.named("volume")).to(VOLUME); | 43 bindConstant().annotatedWith(Names.named("volume")).to(VOLUME); |
| 42 bindConstant().annotatedWith(Names.named("weight")).to(WEIGHT); | 44 bindConstant().annotatedWith(Names.named("weight")).to(WEIGHT); |
| 43 bindConstant().annotatedWith(Names.named("seeds")).to(SEEDS); | 45 bindConstant().annotatedWith(Names.named("seeds")).to(SEEDS); |
| 44 bindConstant().annotatedWith(Names.named("worms")).to(WORMS); | 46 bindConstant().annotatedWith(Names.named("worms")).to(WORMS); |
| 45 bindConstant().annotatedWith(Names.named("leaves")).to(LEAVES); | 47 bindConstant().annotatedWith(Names.named("leaves")).to(LEAVES); |
| 46 bindConstant().annotatedWith(Names.named("name")).to(NAME); | 48 bindConstant().annotatedWith(Names.named("name")).to(NAME); |
| 47 bindConstant().annotatedWith(Names.named("color")).to(COLOR); | 49 bindConstant().annotatedWith(Names.named("color")).to(COLOR); |
| 50 |
| 51 // Bind enum with custom implementation. |
| 52 bindConstant().annotatedWith(Names.named("alternativeColor")).to(ALTERNATIVE
_COLOR); |
| 53 bindConstant().annotatedWith(Names.named("family")).to(FAMILY); |
| 48 } | 54 } |
| 49 } | 55 } |
| OLD | NEW |