protected MethodMetadataBuilder getMutatorMethod(final JavaSymbolName fieldName, final JavaType parameterType) { return getMutatorMethod( fieldName, parameterType, InvocableMemberBodyBuilder.getInstance().appendFormalLine( "this." + fieldName.getSymbolName() + " = " + fieldName.getSymbolName() + ";")); }
protected MethodMetadata getMutatorMethod(final FieldMetadata field) { // Check if the mutator has been cached MethodMetadataBuilder mutator = mutatorMethods.get(field); if (mutator == null) { mutator = getMutatorMethod(field.getFieldName(), field.getFieldType()); mutatorMethods.put(field, mutator); } // Return governor method if (mutator == null) { return getGovernorMethod(BeanInfoUtils.getMutatorMethodName(field.getFieldName()), field.getFieldType()); } return mutator.build(); }
/** * Ensures that the governor has provided field. You could indicates if * is necessary to generate the accessor and the mutator methods for this new field manually. * * @param FieldMetadataBuilder the field to include(required) * @since 2.0 */ protected final void ensureGovernorHasField(final FieldMetadataBuilder fieldMetadata, boolean includeAccessor, boolean includeMutator) { if (governorTypeDetails.getField(fieldMetadata.getFieldName()) == null) { builder.addField(fieldMetadata); } if (includeAccessor) { MethodMetadata accessorMethod = getAccessorMethod(fieldMetadata.build()); if (accessorMethod != null && governorTypeDetails.getMethod(accessorMethod.getMethodName()) == null) { builder.addMethod(accessorMethod); } } if (includeMutator) { MethodMetadata mutatorMethod = getMutatorMethod(fieldMetadata.build()); if (mutatorMethod != null && governorTypeDetails.getMethod(mutatorMethod.getMethodName()) == null) { builder.addMethod(mutatorMethod); } } }
protected MethodMetadataBuilder getMutatorMethod(final JavaSymbolName fieldName, final JavaType parameterType) { return getMutatorMethod( fieldName, parameterType, InvocableMemberBodyBuilder.getInstance().appendFormalLine( "this." + fieldName.getSymbolName() + " = " + fieldName.getSymbolName() + ";")); }
protected MethodMetadata getMutatorMethod(final FieldMetadata field) { // Check if the mutator has been cached MethodMetadataBuilder mutator = mutatorMethods.get(field); if (mutator == null) { mutator = getMutatorMethod(field.getFieldName(), field.getFieldType()); mutatorMethods.put(field, mutator); } // Return governor method if (mutator == null) { return getGovernorMethod(BeanInfoUtils.getMutatorMethodName(field.getFieldName()), field.getFieldType()); } return mutator.build(); }
/** * Ensures that the governor has provided field. You could indicates if * is necessary to generate the accessor and the mutator methods for this new field manually. * * @param FieldMetadataBuilder the field to include(required) * @since 2.0 */ protected final void ensureGovernorHasField(final FieldMetadataBuilder fieldMetadata, boolean includeAccessor, boolean includeMutator) { if (governorTypeDetails.getField(fieldMetadata.getFieldName()) == null) { builder.addField(fieldMetadata); } if (includeAccessor) { MethodMetadata accessorMethod = getAccessorMethod(fieldMetadata.build()); if (accessorMethod != null && governorTypeDetails.getMethod(accessorMethod.getMethodName()) == null) { builder.addMethod(accessorMethod); } } if (includeMutator) { MethodMetadata mutatorMethod = getMutatorMethod(fieldMetadata.build()); if (mutatorMethod != null && governorTypeDetails.getMethod(mutatorMethod.getMethodName()) == null) { builder.addMethod(mutatorMethod); } } }