01: /*
02: * Copyright 2004-2005 OpenSymphony
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy
06: * of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations
14: * under the License.
15: *
16: */
17:
18: /*
19: * Previously Copyright (c) 2001-2004 James House
20: */
21: package org.quartz.utils;
22:
23: /**
24: * <p>
25: * Object representing a job or trigger key.
26: * </p>
27: *
28: * @author <a href="mailto:jeff@binaryfeed.org">Jeffrey Wescott</a>
29: */
30: public class Key extends Pair {
31:
32: /*
33: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34: *
35: * Constructors.
36: *
37: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38: */
39:
40: /**
41: * Construct a new key with the given name and group.
42: *
43: * @param name
44: * the name
45: * @param group
46: * the group
47: */
48: public Key(String name, String group) {
49: super ();
50: super .setFirst(name);
51: super .setSecond(group);
52: }
53:
54: /*
55: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56: *
57: * Interface.
58: *
59: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60: */
61:
62: /**
63: * <p>
64: * Get the name portion of the key.
65: * </p>
66: *
67: * @return the name
68: */
69: public String getName() {
70: return (String) getFirst();
71: }
72:
73: /**
74: * <p>
75: * Get the group portion of the key.
76: * </p>
77: *
78: * @return the group
79: */
80: public String getGroup() {
81: return (String) getSecond();
82: }
83:
84: /**
85: * <p>
86: * Return the string representation of the key. The format will be:
87: * <group>.<name>.
88: * </p>
89: *
90: * @return the string representation of the key
91: */
92: public String toString() {
93: return getGroup() + '.' + getName();
94: }
95: }
96:
97: // EOF
|