01: /*
02: * Copyright 2007 Giordano Maestro (giordano.maestro@assetdata.it)
03: *
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
06: * use this file except in compliance with the License.
07: *
08: * You may obtain a copy of the License at
09: * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
10: * or agreed to in writing, software distributed under the License is
11: * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
12: * KIND, either express or implied. See the License for the specific language
13: * governing permissions and limitations under the License.
14: */
15: package org.romaframework.core.serializer;
16:
17: import java.util.HashMap;
18: import java.util.Map;
19:
20: /**
21: * Register the default values of any aspect
22: * @author Giordano Maestro(giordano.maestro@assetdata.it) 09/nov/07
23: *
24: */
25: public class DefaultValues {
26: private static Map<String, Map<String, Object>> initialValues = new HashMap<String, Map<String, Object>>();
27:
28: private static DefaultValues instance = new DefaultValues();
29:
30: private DefaultValues() {
31: }
32:
33: public static DefaultValues getInstance() {
34: return instance;
35: }
36:
37: public void setDefaultValues(String aspectName,
38: Map<String, Object> defaultValues) {
39: if (initialValues.get(aspectName) == null) {
40: initialValues.put(aspectName, defaultValues);
41: }
42: }
43:
44: public Object getDefaultValue(String iAspect, String feature) {
45: Map<String, Object> map = initialValues.get(iAspect);
46: if (map != null) {
47: return map.get(feature);
48: } else {
49: return null;
50: }
51: }
52: }
|