Class NestmateAccessorGenerator
java.lang.Object
dev.morphia.critter.parser.generator.NestmateAccessorGenerator
Generates a
PropertyAccessor implementation that uses direct
getfield/putfield (for fields) or invokevirtual (for getter/setter methods)
to access entity properties. The generated class must be defined as a hidden nestmate of the entity
class so the JVM grants it private-member access.
Array-typed properties are not supported: the BSON codec provides Object[] at runtime,
which is incompatible with putfield to a typed array field. Callers should throw
to trigger CritterMapper fallback to reflection for such entities.
-
Constructor Summary
ConstructorsConstructorDescriptionNestmateAccessorGenerator(Class<?> entity, FieldInfo field) NestmateAccessorGenerator(Class<?> entity, MethodInfo method) -
Method Summary
-
Constructor Details
-
NestmateAccessorGenerator
-
NestmateAccessorGenerator
-
-
Method Details
-
generate
public byte[] generate()Generates the accessor bytecode.- Throws:
IllegalArgumentException- if the property type is an array (BSON codec providesObject[]which is incompatible with typed array putfield at runtime)
-