Skip to content

Method: of(Object)

1: package de.fhdw.gaming.ipspiel23.c4.utils;
2:
3: /**
4: * A factory for creating {@link ByRef} instances.
5: */
6: public final class MakeRef {
7:
8: /**
9: * unused utility class ctor.
10: */
11: private MakeRef() { }
12:
13: /**
14: * Creates a new {@link ByRef} instance with the provided value ({@code ref} parameter in C#).
15: * @param <T> The type of the referenced value.
16: * @param value The initial value of the reference.
17: * @return The created {@link ByRef} instance.
18: */
19: public static <T> ByRef<T> of(final T value) {
20: return new ByRef<T>(value);
21: }
22:
23: /**
24: * Creates a new empty {@link ByRef} instance ({@code out} parameter in C#).
25: * @param <T> The type of the referenced value.
26: * @return The created {@link ByRef} instance.
27: */
28: public static <T> ByRef<T> empty() {
29: return new ByRef<T>(null);
30: }
31: }