final
classes or overriding methods
which are final or have the same signature and a different return type. This
also eases the integration of types from thirdparty libraries.
StructView
sjava.lang.Closable
.
But a view is not a Stream. There is another class StructViewStream
,
which supports stream like access and iterating over lists of structs.
T get()
/set(T value)
which allow to read/write
the entire struct and an additional method T get(T result)
which writes the result in the given parameter.
void setMember(T value)
T getMember()
T getMember(T result)
T[][] array
produces
T[][] getArray()
T[][] getArray(T[][] v)
T[] getArray(int i)
T[] getArray(T[] v, int i)
T getArray(int i, int j)
T getArray(T v, int i, int j)
class A { public static class B { public int c,d; } public B b; }results in a view
class AView { public static class BView { public int getC(); public int getD(); } public BView b; }Such that the view can be used like this to directly access a member of
B
:
AView view = ...; view.b.getA();Direct access to members of member structs would have not been possible via methods which contain the member of the member in its name, because it would possibly hide other members with the same name. For example a method
AView.getB_getC()
to access member c
in B
, will conflict with a
member b_getC
in A
, which would result in the same method
getB_getC()
in AView
.
Unsafe
interface to modify them.
This either generates more processing effort, or may lead to incompatibilities. Technically,
private members can still be supported through those APIs if the users wants it, which will be most likely the
case in future.
public
). They also need to be static
, because
instances of non-static classes (structs) declared inside of a struct type, have a reference on the
instance of the outer class.
get()
and a method set()
with no parameters,
which refers to an instance of the entire struct. This would make no sense in case of unions.
Struct[]
)
the view currently dynamically instantiates a view instance to encode/decode the array elements on demand.
This can also be solved via static methods instead, or with member fields for each of those types.