1 /* |
1 /* |
2 * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
46 |
46 |
47 /** |
47 /** |
48 * Preregisters factories to create and use a Bark object for use as |
48 * Preregisters factories to create and use a Bark object for use as |
49 * both a Log and a Bark. |
49 * both a Log and a Bark. |
50 */ |
50 */ |
51 public static void preRegister(final Context context) { |
51 public static void preRegister(Context context) { |
52 context.put(barkKey, new Context.Factory<Bark>() { |
52 context.put(barkKey, new Context.Factory<Bark>() { |
53 public Bark make() { |
53 public Bark make(Context c) { |
54 return new Bark(context); |
54 return new Bark(c); |
55 } |
55 } |
56 }); |
56 }); |
57 context.put(Log.logKey, new Context.Factory<Log>() { |
57 context.put(Log.logKey, new Context.Factory<Log>() { |
58 public Log make() { |
58 public Log make(Context c) { |
59 return Bark.instance(context); |
59 return Bark.instance(c); |
60 } |
60 } |
61 }); |
61 }); |
62 } |
62 } |
63 |
63 |
64 /** Get the Bark instance for this context. */ |
64 /** Get the Bark instance for this context. */ |