Class GizmoMemberDescriptor
java.lang.Object
org.optaplanner.core.impl.domain.common.accessor.gizmo.GizmoMemberDescriptor
Describe and provide simplified/unified access for a Member
-
Constructor Summary
ConstructorDescriptionGizmoMemberDescriptor
(Member member) GizmoMemberDescriptor
(String name, Object memberDescriptor, Object metadataDescriptor, Class<?> declaringClass) GizmoMemberDescriptor
(String name, Object memberDescriptor, Object metadataDescriptor, Class<?> declaringClass, io.quarkus.gizmo.MethodDescriptor setterDescriptor) -
Method Summary
Modifier and TypeMethodDescriptionReturns the declaring class name of the member in descriptor format.getName()
Optional<io.quarkus.gizmo.MethodDescriptor>
getType()
Returns the member type (for fields) / return type (for methods) name.io.quarkus.gizmo.ResultHandle
invokeMemberMethod
(io.quarkus.gizmo.BytecodeCreator creator, io.quarkus.gizmo.MethodDescriptor method, io.quarkus.gizmo.ResultHandle bean, io.quarkus.gizmo.ResultHandle... parameters) boolean
Returns true iff the getter is from an interface.io.quarkus.gizmo.ResultHandle
readMemberValue
(io.quarkus.gizmo.BytecodeCreator bytecodeCreator, io.quarkus.gizmo.ResultHandle thisObj) toString()
whenIsField
(Consumer<io.quarkus.gizmo.FieldDescriptor> fieldDescriptorConsumer) If the member accessor is a field, pass the member's field descriptor to the provided consumer.whenIsMethod
(Consumer<io.quarkus.gizmo.MethodDescriptor> methodDescriptorConsumer) If the member accessor is a method, pass the member's method descriptor to the provided consumer.whenMetadataIsOnField
(Consumer<io.quarkus.gizmo.FieldDescriptor> fieldDescriptorConsumer) If the member metadata is on a field, pass the member's field descriptor to the provided consumer.whenMetadataIsOnMethod
(Consumer<io.quarkus.gizmo.MethodDescriptor> methodDescriptorConsumer) If the member metadata is on a method, pass the member's method descriptor to the provided consumer.boolean
writeMemberValue
(io.quarkus.gizmo.BytecodeCreator bytecodeCreator, io.quarkus.gizmo.ResultHandle thisObj, io.quarkus.gizmo.ResultHandle newValue) Write the bytecode for writing to this member.
-
Constructor Details
-
GizmoMemberDescriptor
-
GizmoMemberDescriptor
-
GizmoMemberDescriptor
-
-
Method Details
-
whenIsField
public GizmoMemberDescriptor whenIsField(Consumer<io.quarkus.gizmo.FieldDescriptor> fieldDescriptorConsumer) If the member accessor is a field, pass the member's field descriptor to the provided consumer. Otherwise, do nothing. Returns self for chaining.- Parameters:
fieldDescriptorConsumer
- What to do if the member a field.- Returns:
- this
-
whenIsMethod
public GizmoMemberDescriptor whenIsMethod(Consumer<io.quarkus.gizmo.MethodDescriptor> methodDescriptorConsumer) If the member accessor is a method, pass the member's method descriptor to the provided consumer. Otherwise, do nothing. Returns self for chaining.- Parameters:
methodDescriptorConsumer
- What to do if the member a method.- Returns:
- this
-
readMemberValue
public io.quarkus.gizmo.ResultHandle readMemberValue(io.quarkus.gizmo.BytecodeCreator bytecodeCreator, io.quarkus.gizmo.ResultHandle thisObj) -
writeMemberValue
public boolean writeMemberValue(io.quarkus.gizmo.BytecodeCreator bytecodeCreator, io.quarkus.gizmo.ResultHandle thisObj, io.quarkus.gizmo.ResultHandle newValue) Write the bytecode for writing to this member. If there is no setter, it write the bytecode for throwing the exception. Return true if it was able to write the member value.- Parameters:
bytecodeCreator
- the bytecode creator to usethisObj
- the bean to write the new value tonewValue
- to new value of the member- Returns:
- True if it was able to write the member value, false otherwise
-
whenMetadataIsOnField
public GizmoMemberDescriptor whenMetadataIsOnField(Consumer<io.quarkus.gizmo.FieldDescriptor> fieldDescriptorConsumer) If the member metadata is on a field, pass the member's field descriptor to the provided consumer. Otherwise, do nothing. Returns self for chaining.- Parameters:
fieldDescriptorConsumer
- What to do if the member a field.- Returns:
- this
-
whenMetadataIsOnMethod
public GizmoMemberDescriptor whenMetadataIsOnMethod(Consumer<io.quarkus.gizmo.MethodDescriptor> methodDescriptorConsumer) If the member metadata is on a method, pass the member's method descriptor to the provided consumer. Otherwise, do nothing. Returns self for chaining.- Parameters:
methodDescriptorConsumer
- What to do if the member a method.- Returns:
- this
-
getDeclaringClassName
Returns the declaring class name of the member in descriptor format. For instance, the declaring class name of Object.toString() is "java/lang/Object".- Returns:
- Returns the declaring class name of the member in descriptor format
-
isInterfaceMethod
public boolean isInterfaceMethod()Returns true iff the getter is from an interface.- Returns:
- true iff the getter is from an interface
-
invokeMemberMethod
public io.quarkus.gizmo.ResultHandle invokeMemberMethod(io.quarkus.gizmo.BytecodeCreator creator, io.quarkus.gizmo.MethodDescriptor method, io.quarkus.gizmo.ResultHandle bean, io.quarkus.gizmo.ResultHandle... parameters) -
getSetter
-
getName
-
getTypeName
Returns the member type (for fields) / return type (for methods) name. The name does not include generic information. -
getType
-
toString
-