My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright 2012 stanislawbartkowski@gmail.com
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.javahotel.common.toobject;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import com.gwtmodel.table.common.dateutil.DateP;
import com.gwtmodel.table.mapxml.IDataContainer;
import com.javahotel.types.DecimalP;

/**
* @author hotel
*
*/
@SuppressWarnings("serial")
public class DContainer implements IDataContainer, Serializable {

// cannot be final because if not serializable by GWT
private Map<String, Object> ma = new HashMap<String, Object>();

public Set<String> getKeys() {
return ma.keySet();
}

public Object get(Object key) {
Object o = ma.get(key);
if (o instanceof DateP) {
DateP d = (DateP) o;
return d.getD();
}
if (o instanceof DecimalP) {
DecimalP d = (DecimalP) o;
return d.getDecim();
}
return o;
}

public Object put(String key, Object val) {
Object o = ma.get(key);
if (val instanceof Date) {
DateP d = null;
if (o != null) {
d = (DateP) o;
}
if (d == null) {
d = new DateP();
}
d.setD((Date) val);
return ma.put(key, d);
}
if (val instanceof BigDecimal) {
DecimalP d = null;
if (o != null) {
d = (DecimalP) o;
}
if (d == null) {
d = new DecimalP();
}
d.setDecim((BigDecimal) val);
return ma.put(key, d);
}
return ma.put(key, val);
}
}

Change log

r573 by stanislawbartkowski on Mar 31, 2012   Diff
Changes related to relocating DateP class
Go to: 
Project members, sign in to write a code review

Older revisions

r525 by stanislawbartkowski on Jan 1, 2012   Diff
[No log message]
r507 by stanislawbartkowski on Dec 26, 2011   Diff
Changes related to invoice making
All revisions of this file

File info

Size: 2302 bytes, 79 lines

File properties

svn:mime-type
text/plain
Powered by Google Project Hosting