protected MethodMetadataBuilder getAccessorMethod(final JavaSymbolName fieldName, final JavaType fieldType) { return getAccessorMethod(fieldName, fieldType, InvocableMemberBodyBuilder.getInstance() .appendFormalLine("return " + fieldName + ";")); }
protected MethodMetadata getAccessorMethod(final FieldMetadata field) { // Check if this method has been cached MethodMetadataBuilder accessor = accessorMethods.get(field); if (accessor == null) { accessor = getAccessorMethod( field, InvocableMemberBodyBuilder.getInstance().appendFormalLine( "return " + field.getFieldName().getSymbolName() + ";")); accessorMethods.put(field, accessor); } // Return governor method if exists if (accessor == null) { return getGovernorMethod(BeanInfoUtils.getAccessorMethodName(field)); } return accessor.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 getAccessorMethod(final JavaSymbolName fieldName, final JavaType fieldType) { return getAccessorMethod(fieldName, fieldType, InvocableMemberBodyBuilder.getInstance() .appendFormalLine("return " + fieldName + ";")); }
protected MethodMetadata getAccessorMethod(final FieldMetadata field) { // Check if this method has been cached MethodMetadataBuilder accessor = accessorMethods.get(field); if (accessor == null) { accessor = getAccessorMethod( field, InvocableMemberBodyBuilder.getInstance().appendFormalLine( "return " + field.getFieldName().getSymbolName() + ";")); accessorMethods.put(field, accessor); } // Return governor method if exists if (accessor == null) { return getGovernorMethod(BeanInfoUtils.getAccessorMethodName(field)); } return accessor.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); } } }