A NamedIndirect is an Indirect Object that also has a String name associated with the Indirect. @param The format of the Object returned by the underlying Indirect
| 25 | * The format of the Object returned by the underlying Indirect |
| 26 | */ |
| 27 | public class NamedIndirect<T> |
| 28 | { |
| 29 | |
| 30 | /** |
| 31 | * The underlying Indirect of the NamedIndirect. |
| 32 | * |
| 33 | * This is stored as an indirect, since it is possible that it's a reference to an |
| 34 | * object that may not have been present/constructed when the instructions were |
| 35 | * processed from the persistent file format. |
| 36 | */ |
| 37 | private final Indirect<T> object; |
| 38 | |
| 39 | /** |
| 40 | * The name of the NamedIndirect. |
| 41 | */ |
| 42 | private final CaseInsensitiveString name; |
| 43 | |
| 44 | /** |
| 45 | * Constructs a new NamedIndirect with the given name, Format of the value, and value |
| 46 | * of the NamedIndirect. |
| 47 | * |
| 48 | * @param name |
| 49 | * The name of this NamedIndirect |
| 50 | * @param object |
| 51 | * The value of this NamedIndirect |
| 52 | * @param manager |
| 53 | * The FormatManager used to unconvert the value |
| 54 | */ |
| 55 | public NamedIndirect(String name, T object, FormatManager<T> manager) |
| 56 | { |
| 57 | this.name = new CaseInsensitiveString(name); |
| 58 | this.object = new BasicIndirect<>(manager, object); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Constructs a new NamedIndirect with the given name, Format of the value, and |
| 63 | * instructions for the underlying value of the NamedIndirect. |
| 64 | * |
| 65 | * @param name |
| 66 | * The name of this NamedIndirect |
| 67 | * @param manager |
| 68 | * The FormatManager used to convert the instructions |
| 69 | * @param instructions |
| 70 | * The instructions to be used to determine the value of this NamedIndirect |
| 71 | */ |
| 72 | public NamedIndirect(String name, FormatManager<T> manager, String instructions) |
| 73 | { |
| 74 | this.name = new CaseInsensitiveString(name); |
| 75 | object = manager.convertIndirect(instructions); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Returns the name of the NamedIndirect. |
| 80 | * |
| 81 | * @return The name of the NamedIndirect |
| 82 | */ |
| 83 | public String getName() |
| 84 | { |
nothing calls this directly
no outgoing calls
no test coverage detected