My favorites | Sign in
Project Home 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
/*
* @(#)ImmutableUserType.java 25 Feb 2009
*
* Copyright © 2009 Andrew Phillips.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.qrmedia.commons.persistence.hibernate.usertype;

import org.hibernate.HibernateException;
import org.hibernate.usertype.UserType;

/**
* A base {@link UserType} for immutable values.
*
* @author anph
* @since 25 Feb 2009
*
*/
public abstract class ImmutableUserType extends MutableUserType {

/* (non-Javadoc)
* @see org.hibernate.usertype.UserType#isMutable()
*/
public final boolean isMutable() {
return false;
}

/* (non-Javadoc)
* @see org.hibernate.usertype.UserType#deepCopy(java.lang.Object)
*/
public Object deepCopy(Object value) throws HibernateException {
// for immutable objects, a reference to the original is fine
return value;
}

}

Change log

r515 by sharedocs1 on Nov 3, 2009   Diff
Made implementations that shouldn't be
overridden final and added documentation
for a condition of the deepCopy
implementation.
Go to: 
Project members, sign in to write a code review

Older revisions

r480 by sharedocs1 on Nov 2, 2009   Diff
Factored the dirty checking option for
mutable types out into a separate
UserType.
r82 by sharedocs1 on Oct 6, 2009   Diff
Tightened up the conditions on one of
the tests and renamed all the
Abstract* classes, removing the
superfluous Abstract from the name.
See one of Adam Bien's blog posts.
r57 by sharedocs1 on Jun 14, 2009   Diff
[No log message]
All revisions of this file

File info

Size: 1527 bytes, 48 lines
Powered by Google Project Hosting