01: /*****************************************************************************
02: * Copyright (C) PicoContainer Organization. All rights reserved. *
03: * ------------------------------------------------------------------------- *
04: * The software in this package is published under the terms of the BSD *
05: * style license a copy of which has been included with this distribution in *
06: * the LICENSE.txt file. *
07: * *
08: * Original code by *
09: *****************************************************************************/package org.picocontainer;
10:
11: import java.util.Properties;
12:
13: /**
14: * Collection of immutable properties, holding behaviour characteristics.
15: *
16: * @author Paul Hammant
17: */
18: public final class Characteristics {
19:
20: private static final String _INJECTION = "injection";
21: private static final String _NONE = "none";
22: private static final String _CONSTRUCTOR = "constructor";
23: private static final String _METHOD = "method";
24: private static final String _SETTER = "setter";
25: private static final String _CACHE = "cache";
26: private static final String _JMX = "jmx";
27: private static final String _SYNCHRONIZING = "synchronizing";
28: private static final String _LOCKING = "locking";
29: private static final String _HIDE_IMPL = "hide-impl";
30: private static final String _PROPERTY_APPLYING = "property-applying";
31: private static final String _AUTOMATIC = "automatic";
32: private static final String _USE_NAMES = "use-parameter-names";
33:
34: private static final String FALSE = "false";
35: private static final String TRUE = "true";
36:
37: public static final Properties CDI = immutable(_INJECTION,
38: _CONSTRUCTOR);
39:
40: public static final Properties SDI = immutable(_INJECTION, _SETTER);
41:
42: public static final Properties METHOD_INJECTION = immutable(
43: _INJECTION, _METHOD);
44:
45: public static final Properties NO_CACHE = immutable(_CACHE, FALSE);
46:
47: public static final Properties CACHE = immutable(_CACHE, TRUE);
48:
49: public static final Properties NO_JMX = immutable(_JMX, FALSE);
50:
51: public static final Properties SYNCHRONIZE = immutable(
52: _SYNCHRONIZING, TRUE);
53:
54: public static final Properties LOCK = immutable(_LOCKING, TRUE);
55:
56: public static final Properties SINGLE = CACHE;
57:
58: public static final Properties HIDE_IMPL = immutable(_HIDE_IMPL,
59: TRUE);
60:
61: public static final Properties NO_HIDE_IMPL = immutable(_HIDE_IMPL,
62: FALSE);
63:
64: public static final Properties NONE = immutable(_NONE, "");
65:
66: public static final Properties PROPERTY_APPLYING = immutable(
67: _PROPERTY_APPLYING, TRUE);
68:
69: public static final Properties AUTOMATIC = immutable(_AUTOMATIC,
70: TRUE);
71:
72: public static final Properties USE_NAMES = immutable(_USE_NAMES,
73: TRUE);
74:
75: private static Properties immutable(String name, String value) {
76: return new ImmutableProperties(name, value);
77: }
78:
79: public static class ImmutableProperties extends Properties {
80:
81: public ImmutableProperties(String name, String value) {
82: super .setProperty(name, value);
83: }
84:
85: public Object remove(Object o) {
86: throw new UnsupportedOperationException();
87: }
88:
89: public synchronized Object setProperty(String string,
90: String string1) {
91: throw new UnsupportedOperationException();
92: }
93: }
94:
95: }
|