mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-08 12:14:47 +00:00
c654277e62
git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@11765 1b8cb986-b30d-0410-93ca-fae66ebed9b2
50 lines
1.0 KiB
Java
50 lines
1.0 KiB
Java
// $Id$
|
|
package org.hibernate;
|
|
|
|
import java.util.Map;
|
|
import java.util.HashMap;
|
|
import java.io.Serializable;
|
|
|
|
/**
|
|
* Defines the representation modes available for entities.
|
|
*
|
|
* @author Steve Ebersole
|
|
*/
|
|
public class EntityMode implements Serializable {
|
|
|
|
private static final Map INSTANCES = new HashMap();
|
|
|
|
public static final EntityMode POJO = new EntityMode( "pojo" );
|
|
public static final EntityMode DOM4J = new EntityMode( "dom4j" );
|
|
public static final EntityMode MAP = new EntityMode( "dynamic-map" );
|
|
|
|
static {
|
|
INSTANCES.put( POJO.name, POJO );
|
|
INSTANCES.put( DOM4J.name, DOM4J );
|
|
INSTANCES.put( MAP.name, MAP );
|
|
}
|
|
|
|
private final String name;
|
|
|
|
public EntityMode(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public String toString() {
|
|
return name;
|
|
}
|
|
|
|
private Object readResolve() {
|
|
return INSTANCES.get( name );
|
|
}
|
|
|
|
public static EntityMode parse(String name) {
|
|
EntityMode rtn = ( EntityMode ) INSTANCES.get( name );
|
|
if ( rtn == null ) {
|
|
// default is POJO
|
|
rtn = POJO;
|
|
}
|
|
return rtn;
|
|
}
|
|
}
|