/demos/helloorm/src/com/google/appengine/demos/helloorm/PersistenceStandard.java
Java | 24 lines | 14 code | 6 blank | 4 comment | 0 complexity | eb2d06f7909fc7e23f3805a6bb6e3482 MD5 | raw file
1// Copyright 2008 Google Inc. All Rights Reserved. 2package com.google.appengine.demos.helloorm; 3 4/** 5 * @author Max Ross <maxr@google.com> 6 */ 7public enum PersistenceStandard { 8 9 JPA, JDO; 10 11 private static final String SYS_PROP = "helloorm.persistence.standard"; 12 13 public static synchronized PersistenceStandard get() { 14 return PersistenceStandard.valueOf(System.getProperty(SYS_PROP)); 15 } 16 17 public static synchronized void set(PersistenceStandard ps) { 18 System.setProperty(SYS_PROP, ps.name()); 19 } 20 21 public PersistenceStandard getAlternate() { 22 return PersistenceStandard.values()[(this.ordinal() + 1) % 2]; 23 } 24}