001 002/* 003 * Copyright (C) 2010 Archie L. Cobbs. All rights reserved. 004 * 005 * $Id$ 006 */ 007 008package org.dellroad.jibxbindings.pidf.held; 009 010/** 011 * The {@code <held:locationRequest>} XML element. 012 */ 013public class LocationRequest implements Cloneable { 014 015 /** 016 * Possible value for {@link #getResponseTime}. 017 */ 018 public static final String EMERGENCY_DISPATCH = "emergencyDispatch"; 019 020 /** 021 * Possible value for {@link #getResponseTime}. 022 */ 023 public static final String EMERGENCY_ROUTING = "emergencyRouting"; 024 025 private String responseTime; 026 private LocationType locationType; 027 028 public String getResponseTime() { 029 return this.responseTime; 030 } 031 public void setResponseTime(String responseTime) { 032 this.responseTime = responseTime; 033 } 034 035 /** 036 * Parse the response time as a seconds value. 037 * 038 * @throws NumberFormatException if response time is not parseable, e.g., equal to {@link #EMERGENCY_DISPATCH} 039 */ 040 public int getReponseTimeInSeconds() { 041 return Integer.parseInt(this.responseTime, 10); 042 } 043 044 public LocationType getLocationType() { 045 return this.locationType; 046 } 047 public void setLocationType(LocationType locationType) { 048 this.locationType = locationType; 049 } 050 051// Cloneable 052 053 @Override 054 public LocationRequest clone() { 055 final LocationRequest clone; 056 try { 057 clone = (LocationRequest)super.clone(); 058 } catch (CloneNotSupportedException e) { 059 throw new RuntimeException(e); 060 } 061 clone.locationType = this.locationType != null ? this.locationType.clone() : null; 062 return clone; 063 } 064} 065