MCPcopy Create free account
hub / github.com/PCGen/pcgen / CDOMSingleRef

Class CDOMSingleRef

code/src/java/pcgen/cdom/reference/CDOMSingleRef.java:30–87  ·  view source on GitHub ↗

A CDOMSingleRef is a CDOMReference which is intended to contain a single object of a given Type for the Class this CDOMSingleRef represents. @param The Class of the underlying object contained by this CDOMSingleRef

Source from the content-addressed store, hash-verified

28 * The Class of the underlying object contained by this CDOMSingleRef
29 */
30public abstract class CDOMSingleRef<T> extends CDOMReference<T> implements Indirect<T>
31{
32
33 /**
34 * Constructs a new CDOMSingleRef for the given name.
35 *
36 * @param key
37 * An identifier of the object this CDOMSingleRef contains.
38 */
39 public CDOMSingleRef(String key)
40 {
41 super(key);
42 }
43
44 /**
45 * Returns one: The count of the number of objects included in the
46 * Collection of Objects to which this CDOMSingleRef refers.
47 *
48 * @return one (since this is a single reference)
49 */
50 @Override
51 public int getObjectCount()
52 {
53 return 1;
54 }
55
56 /**
57 * Returns the given Object this CDOMSingleRef contains.
58 *
59 * Note that the behavior of this class is undefined if the CDOMSingleRef
60 * has not yet been resolved.
61 *
62 * @return the given Object this CDOMSingleRef contains.
63 */
64 @Override
65 public abstract T get();
66
67 /**
68 * Returns true if this CDOMSingleRef has been resolved; false otherwise.
69 *
70 * @return true if this CDOMSingleRef has been resolved; false otherwise
71 */
72 public abstract boolean hasBeenResolved();
73
74 /**
75 * Sets the choice for this CDOMSingleRef.
76 *
77 * @param choice The choice to be set for this CDOMSingleRef
78 */
79 public abstract void setChoice(String choice);
80
81 @Override
82 public String getUnconverted()
83 {
84 return getName();
85 }
86
87}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected