@Override public void enumConstant(final JavaType name, final JavaSymbolName fieldName, final boolean permitReservedWords) { if (!permitReservedWords) { // No need to check the "name" as if the class exists it is assumed // it is a legal name ReservedWords.verifyReservedWordsNotPresent(fieldName); } final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA)); typeManagementService.addEnumConstant(declaredByMetadataId, fieldName); }
public static void verifyReservedWordsNotPresent(final JavaType javaType) { verifyReservedJavaKeywordsNotPresent(javaType); verifyReservedSqlKeywordsNotPresent(javaType); }
ReservedWords.verifyReservedWordsNotPresent(name); } catch (IllegalStateException exception) { LOGGER.log(Level.INFO, ReservedWords.verifyReservedSqlKeywordsNotPresent(table); } catch (IllegalStateException exception) { LOGGER.log(Level.INFO, ReservedWords.verifyReservedJavaKeywordsNotPresent(name); } catch (IllegalStateException exception) { LOGGER
ReservedWords.verifyReservedWordsNotPresent(name); } catch (IllegalStateException exception) { LOGGER.log(Level.INFO, ReservedWords.verifyReservedSqlKeywordsNotPresent(table); } catch (IllegalStateException exception) { LOGGER.log(Level.INFO, ReservedWords.verifyReservedJavaKeywordsNotPresent(name); } catch (IllegalStateException exception) { LOGGER
@Override public void createInterface(final JavaType name, final LogicalPath path, final boolean permitReservedWords) { if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(name); } final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, path); final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, name, PhysicalTypeCategory.INTERFACE); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); }
public static void verifyReservedWordsNotPresent(final JavaSymbolName javaSymbolName) { verifyReservedJavaKeywordsNotPresent(javaSymbolName); verifyReservedSqlKeywordsNotPresent(javaSymbolName); }
@Override public void createEnum(final JavaType name, final LogicalPath path, final boolean permitReservedWords) { if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(name); } final String physicalTypeId = PhysicalTypeIdentifier.createIdentifier(name, path); final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(physicalTypeId, Modifier.PUBLIC, name, PhysicalTypeCategory.ENUMERATION); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); }
public static void verifyReservedWordsNotPresent(final String string) { verifyReservedJavaKeywordsNotPresent(string); verifyReservedSqlKeywordsNotPresent(string); }
@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); }
ReservedWords.verifyReservedWordsNotPresent(klass);
@CliCommand( value = "embeddable", help = "Creates a new Java class source file with the JPA `@Embeddable` annotation in the directory _src/main/java_ of the selected project module (if any).") public void createEmbeddableClass( @CliOption(key = "class", optionContext = UPDATE_PROJECT, mandatory = true, help = "The name of the embeddable class to create. If you consider it " + "necessary, you can also specify the package (base package can be " + "specified with `~`). Ex.: `--class ~.domain.MyEmbeddableClass`. " + "You can specify module as well, if necessary. " + "Ex.: `--class model:~.domain.MyEmbeddableClass`. When working " + "with a multi-module project, if module is not specified the class " + "will be created in the module which has the focus.") final JavaType name, @CliOption(key = "serializable", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Whether the generated class should implement `java.io.Serializable`. " + "Default if option present: `true`; default if option not present: `false`.") final boolean serializable, @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(name); } jpaOperations.newEmbeddableClass(name, serializable); }
final boolean createAbstract, final boolean permitReservedWords) { if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(name);
final boolean permitReservedWords, final boolean transientModifier) { if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(fieldDetails.getFieldName()); if (fieldDetails.getColumn() != null) { ReservedWords.verifyReservedWordsNotPresent(fieldDetails.getColumn());
ReservedWords.verifyReservedWordsNotPresent(fieldDetails.getFieldName()); if (fieldDetails.getColumn() != null) { ReservedWords.verifyReservedWordsNotPresent(fieldDetails.getColumn());
ReservedWords.verifyReservedWordsNotPresent(fieldDetails.getFieldName()); if (fieldDetails.getColumn() != null) { ReservedWords.verifyReservedWordsNotPresent(fieldDetails.getColumn());
@Override public void enumConstant(final JavaType name, final JavaSymbolName fieldName, final boolean permitReservedWords) { if (!permitReservedWords) { // No need to check the "name" as if the class exists it is assumed // it is a legal name ReservedWords.verifyReservedWordsNotPresent(fieldName); } final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, pathResolver.getFocusedPath(Path.SRC_MAIN_JAVA)); typeManagementService.addEnumConstant(declaredByMetadataId, fieldName); }
@Override public void createEnum(final JavaType name, final LogicalPath path, final boolean permitReservedWords) { if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(name); } final String physicalTypeId = PhysicalTypeIdentifier.createIdentifier(name, path); final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(physicalTypeId, Modifier.PUBLIC, name, PhysicalTypeCategory.ENUMERATION); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); }
@Override public void createInterface(final JavaType name, final LogicalPath path, final boolean permitReservedWords) { if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(name); } final String declaredByMetadataId = PhysicalTypeIdentifier.createIdentifier(name, path); final ClassOrInterfaceTypeDetailsBuilder cidBuilder = new ClassOrInterfaceTypeDetailsBuilder(declaredByMetadataId, Modifier.PUBLIC, name, PhysicalTypeCategory.INTERFACE); typeManagementService.createOrUpdateTypeOnDisk(cidBuilder.build()); }
@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 projectType, @CliOption(key = "permitReservedWords", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Indicates whether reserved words are ignored by Roo") final boolean permitReservedWords) { // Check if specified type exists in the project String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(projectType); if (physicalTypeIdentifier == null) { throw new IllegalArgumentException(String.format( "The class '%s' doesn't exists in the project. Please, specify an existing class", projectType)); } if (!permitReservedWords) { ReservedWords.verifyReservedWordsNotPresent(projectType); } unitTestOperations.newUnitTest(projectType); }
@CliCommand( value = "embeddable", help = "Creates a new Java class source file with the JPA `@Embeddable` annotation in the directory _src/main/java_ of the selected project module (if any).") public void createEmbeddableClass( @CliOption(key = "class", optionContext = UPDATE_PROJECT, mandatory = true, help = "The name of the embeddable class to create. If you consider it " + "necessary, you can also specify the package (base package can be " + "specified with `~`). Ex.: `--class ~.domain.MyEmbeddableClass`. " + "You can specify module as well, if necessary. " + "Ex.: `--class model:~.domain.MyEmbeddableClass`. When working " + "with a multi-module project, if module is not specified the class " + "will be created in the module which has the focus.") final JavaType name, @CliOption(key = "serializable", mandatory = false, unspecifiedDefaultValue = "false", specifiedDefaultValue = "true", help = "Whether the generated class should implement `java.io.Serializable`. " + "Default if option present: `true`; default if option not present: `false`.") final boolean serializable, @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(name); } jpaOperations.newEmbeddableClass(name, serializable); }