protected MethodMetadataBuilder getAccessorMethod(final JavaSymbolName fieldName, final JavaType fieldType, final InvocableMemberBodyBuilder bodyBuilder) { return getMethod(PUBLIC, BeanInfoUtils.getAccessorMethodName(fieldName, fieldType), fieldType, null, null, bodyBuilder); }
public JavaSymbolName getEmbeddedFieldMutatorMethodName(final JavaSymbolName fieldName) { return BeanInfoUtils.getMutatorMethodName(fieldName); }
if (!BeanInfoUtils.isAccessorMethod(method) || method.hasSameName(identifierAccessor, versionAccessor)) { continue; final FieldMetadata field = BeanInfoUtils.getFieldForJavaBeanMethod(this, method); if (field == null || field.getCustomData().keySet().contains(CustomDataKeys.TRANSIENT_FIELD) || !BeanInfoUtils.hasAccessorAndMutator(field, this)) { continue;
/** * Attempts to locate the field which is represented by the presented java * bean method. * <p> * Not every JavaBean getter or setter actually backs to a field with an * identical name. In such cases, null will be returned. * * @param memberDetails the member holders to scan (required) * @param method the method name (required) * @return the field if found, or null if it could not be found */ public static FieldMetadata getFieldForJavaBeanMethod(final MemberDetails memberDetails, final MethodMetadata method) { Validate.notNull(memberDetails, "Member details required"); Validate.notNull(method, "Method is required"); final JavaSymbolName propertyName = getPropertyNameForJavaBeanMethod(method); return getFieldForPropertyName(memberDetails, propertyName); }
/** * Attempts to locate an accessor and a mutator method for a given field. * <p> * Not every JavaBean getter or setter actually backs to a field with an * identical name. In such cases, false will be returned. * * @param field the member holders to scan (required) * @param memberDetails the member details to scan * @return true if an accessor and a mutator are present, or false otherwise */ public static boolean hasAccessorAndMutator(final FieldMetadata field, final MemberDetails memberDetails) { Validate.notNull(field, "Field required"); Validate.notNull(memberDetails, "Member details required"); if (memberDetails.getMethod(getAccessorMethodName(field), new ArrayList<JavaType>()) != null && memberDetails .getMethod(getMutatorMethodName(field), Arrays.asList(field.getFieldType())) != null) { return true; } return false; }
for (MethodMetadata method : memberHoldingTypeDetails .getDeclaredMethods()) { if (BeanInfoUtils.isAccessorMethod(method)) { .getPropertyNameForJavaBeanMethod(method); .getFieldForPropertyName(members, propertyName); if (field != null) { if (MemberFindingUtils.getAnnotationOfType(field
if (!BeanInfoUtils.isAccessorMethod(method)) { continue; .getFieldForJavaBeanMethod(memberDetails, method); if (field == null) { continue;
@CliCommand(value = "test unit", help = "Creates a unit test class with a basic structure and with the " + "necessary testing components, for the specified class.") public void newMockTest( @CliOption( key = "class", mandatory = true, optionContext = UPDATE_PROJECT, help = "The name of the project class which this unit test class is targeting. If you consider " + "it necessary, you can also specify the package. Ex.: `--class ~.model.MyClass` (where " + "`~` is the base package). When working with multiple modules, you should specify the name" + " of the class and the module where it is. Ex.: `--class model:~.MyClass`. If the module " + "is not specified, it is assumed that the class is in the module which has the focus. ") final JavaType type, @CliOption(key = "permitReservedWords", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates whether reserved words are ignored by Roo. " + "Default if option present: `true`; default if option not present: `false`.") final boolean permitReservedWords) { if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(type); } Validate .isTrue( BeanInfoUtils.isEntityReasonablyNamed(type), "Cannot create an integration test for an entity named 'Test' or 'TestCase' under any circumstances"); testOperations.createUnitTest(type); }
if (!BeanInfoUtils.isMutatorMethod(method)) { continue; final FieldMetadata field = BeanInfoUtils.getFieldForJavaBeanMethod(memberDetails, method); if (field == null) { continue;
/** * Attempts to locate an accessor and a mutator method for a given field. * <p> * Not every JavaBean getter or setter actually backs to a field with an * identical name. In such cases, false will be returned. * * @param field the member holders to scan (required) * @param memberDetails the member details to scan * @return true if an accessor and a mutator are present, or false otherwise */ public static boolean hasAccessorAndMutator(final FieldMetadata field, final MemberDetails memberDetails) { Validate.notNull(field, "Field required"); Validate.notNull(memberDetails, "Member details required"); if (memberDetails.getMethod(getAccessorMethodName(field), new ArrayList<JavaType>()) != null && memberDetails .getMethod(getMutatorMethodName(field), Arrays.asList(field.getFieldType())) != null) { return true; } return false; }
BeanInfoUtils.isEntityReasonablyNamed(klass), "Cannot create an integration test for an entity named 'Test' or 'TestCase' under any circumstances");
/** * Attempts to locate the field which is represented by the presented java * bean method. * <p> * Not every JavaBean getter or setter actually backs to a field with an * identical name. In such cases, null will be returned. * * @param memberDetails the member holders to scan (required) * @param method the method name (required) * @return the field if found, or null if it could not be found */ public static FieldMetadata getFieldForJavaBeanMethod(final MemberDetails memberDetails, final MethodMetadata method) { Validate.notNull(memberDetails, "Member details required"); Validate.notNull(method, "Method is required"); final JavaSymbolName propertyName = getPropertyNameForJavaBeanMethod(method); return getFieldForPropertyName(memberDetails, propertyName); }
if (!BeanInfoUtils.isMutatorMethod(method)) { continue; final FieldMetadata field = BeanInfoUtils.getFieldForJavaBeanMethod(memberDetails, method); if (field == null) { continue;
/** * Returns the accessor name for the given field. * * @param field the field to determine the accessor name * @return the accessor method name */ public static JavaSymbolName getAccessorMethodName(final FieldMetadata field) { Validate.notNull(field, "Field required"); return getAccessorMethodName(field.getFieldName(), field.getFieldType()); }
public JavaSymbolName getEmbeddedMutatorMethodName() { return BeanInfoUtils.getMutatorMethodName(embeddedField); }
JavaSymbolName accesorName = BeanInfoUtils.getAccessorMethodName(field); JavaSymbolName mutatorName = BeanInfoUtils.getMutatorMethodName(field); if (method.getMethodName().equals(accesorName) || method.getMethodName().equals(mutatorName)) {
if (!BeanInfoUtils.isAccessorMethod(method) || method.hasSameName(identifierAccessor, versionAccessor)) { continue; final FieldMetadata field = BeanInfoUtils.getFieldForJavaBeanMethod(this, method); if (field == null || field.getCustomData().keySet().contains(CustomDataKeys.TRANSIENT_FIELD) || !BeanInfoUtils.hasAccessorAndMutator(field, this)) { continue;
if (!BeanInfoUtils.isEntityReasonablyNamed(name)) { if (!permitReservedWords) { throw new IllegalArgumentException(
protected MethodMetadataBuilder getAccessorMethod(final FieldMetadata field, final InvocableMemberBodyBuilder bodyBuilder) { return getMethod(PUBLIC, BeanInfoUtils.getAccessorMethodName(field), field.getFieldType(), null, null, bodyBuilder); }
/** * Returns the mutator name for the given field. * * @param field the field used to determine the accessor name * @return the mutator method name */ public static JavaSymbolName getMutatorMethodName(final FieldMetadata field) { Validate.notNull(field, "Field metadata required"); return getMutatorMethodName(field.getFieldName()); }