@Override public void focus(final JavaType type) { Validate.notNull(type, "Specify the type to focus on"); final String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(type); Validate.notNull(physicalTypeIdentifier, "Cannot locate the type %s", type.getFullyQualifiedTypeName()); final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService.get(physicalTypeIdentifier); Validate.notNull(ptm, "Class %s does not exist", PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier)); }
@Override public void createUnitTest(JavaType type) { // Check if specified type exists in the project String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(type); if (physicalTypeIdentifier == null) { throw new IllegalArgumentException(String.format( "The class '%s' doesn't exists in the project. Please, specify an existing class", type)); } // Adding unit test dependencies List<TestCreatorProvider> validTestCreators = getValidTestCreatorsForType(type); if (!validTestCreators.isEmpty()) { addUnitTestDependencies(type.getModule()); } // Creating tests if (validTestCreators.isEmpty()) { throw new IllegalArgumentException( "Unable to find a valid test creator for this type of class. " + "Please, select another type of class to generate the test, such as an entity."); } else { for (TestCreatorProvider creator : validTestCreators) { creator.createUnitTest(type); } } }
@Override public void createIntegrationTest(JavaType type, Pom module) { // Check if specified type exists in the project String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(type); if (physicalTypeIdentifier == null) { throw new IllegalArgumentException(String.format( "The class '%s' doesn't exists in the project. Please, specify an existing class", type)); } // Adding integration test dependencies List<TestCreatorProvider> validTestCreators = getValidTestCreatorsForType(type); if (!validTestCreators.isEmpty()) { addIntegrationTestDependencies(module.getModuleName()); } // Creating tests if (validTestCreators.isEmpty()) { throw new IllegalArgumentException( "Unable to find a valid test creator for this type of class. " + "Please, select another type of class to generate the test, such a repository."); } else { for (TestCreatorProvider creator : validTestCreators) { creator.createIntegrationTest(type, module); } } }
private void registerDependencyUponType(final String entityFactoryMetadata, final JavaType type) { final String fieldPhysicalTypeId = getTypeLocationService().getPhysicalTypeIdentifier(type); getMetadataDependencyRegistry().registerDependency(fieldPhysicalTypeId, entityFactoryMetadata); }
+ "module where it is. Ex.: `--type model:~.domain.MyClass`. If the module is not " + "specified, it is assumed that the class is in the module which has the focus.") final JavaType javaType) { final String id = typeLocationService.getPhysicalTypeIdentifier(javaType); if (id == null) { return "Cannot locate source for " + javaType.getFullyQualifiedTypeName();
/** * Returns details of the given Java type's members * * @param type the type for which to get the members (required) * @return <code>null</code> if the member details are unavailable */ protected MemberDetails getMemberDetails(final JavaType type) { TypeLocationService typeLocationService = getTypeLocationService(); Validate.notNull(typeLocationService, "TypeLocationService is required"); final String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(type); if (physicalTypeIdentifier == null) { return null; } // We need to lookup the metadata we depend on final PhysicalTypeMetadata physicalTypeMetadata = (PhysicalTypeMetadata) getMetadataService().get(physicalTypeIdentifier); return getMemberDetails(physicalTypeMetadata); }
typeLocationService.getPhysicalTypeIdentifier(new JavaType(newValue)); if (physicalTypeIdentifier != null) { topLevelPath =
public void onFileEvent(final FileEvent fileEvent) { if (metadataDependencyRegistry == null) { metadataDependencyRegistry = getMetadataDependencyRegistry(); } Validate.notNull(metadataDependencyRegistry, "MetadataDependencyRegistry is required"); if (metadataService == null) { metadataService = getMetadataService(); } Validate.notNull(metadataService, "MetadataService is required"); if (typeLocationService == null) { typeLocationService = getTypeLocationService(); } Validate.notNull(typeLocationService, "TypeLocationService is required"); final String fileIdentifier = fileEvent.getFileDetails().getCanonicalPath(); // Check to see if file is of interest if (fileIdentifier.endsWith(".java") && fileEvent.getOperation() != FileOperation.MONITORING_FINISH && !fileIdentifier.endsWith("package-info.java")) { // Figure out the PhysicalTypeIdentifier final String id = typeLocationService.getPhysicalTypeIdentifier(fileIdentifier); if (id == null) { return; } // Now we've worked out the id, we can publish the event in case // others were interested metadataService.evictAndGet(id); metadataDependencyRegistry.notifyDownstream(id); } }
String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(name); if (physicalTypeIdentifier != null && !shellContext.isForce()) { throw new IllegalArgumentException(
String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(name); if (physicalTypeIdentifier != null && !shellContext.isForce()) { throw new IllegalArgumentException(
typeLocationService.getPhysicalTypeIdentifier(new JavaType(newValue)); if (StringUtils.isNotBlank(physicalTypeIdentifier)) { module =
/** * This method generates the version field using the provided values * * @param entity * @param versionField * @param versionType * @param versionColumn * @return */ private FieldMetadata getVersionField(final JavaType entity, String versionField, final JavaType versionType, final String versionColumn) { if (StringUtils.isEmpty(versionField)) { versionField = "version"; } final List<AnnotationMetadataBuilder> annotations = new ArrayList<AnnotationMetadataBuilder>(); annotations.add(new AnnotationMetadataBuilder(VERSION)); if (StringUtils.isNotEmpty(versionColumn)) { final AnnotationMetadataBuilder columnBuilder = new AnnotationMetadataBuilder(COLUMN); columnBuilder.addStringAttribute("name", versionColumn); annotations.add(columnBuilder); } FieldDetails versionFieldDetails = new FieldDetails(getTypeLocationService().getPhysicalTypeIdentifier(entity), versionType, new JavaSymbolName(versionField)); versionFieldDetails.setModifiers(Modifier.PRIVATE); versionFieldDetails.addAnnotations(annotations); return new FieldMetadataBuilder(versionFieldDetails).build(); }
String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(name); if (physicalTypeIdentifier != null && !shellContext.isForce()) { throw new IllegalArgumentException(
new FieldDetails(getTypeLocationService().getPhysicalTypeIdentifier(entity), identifierType, new JavaSymbolName(identifierField)); identifierFieldDetails.setModifiers(Modifier.PRIVATE);
Validate.notNull(finderName, "ERROR: Finder name required to generate finder."); final String id = getTypeLocationService().getPhysicalTypeIdentifier(entity); if (id == null) { LOGGER.warning("Cannot locate source for '" + entity.getFullyQualifiedTypeName() + "'");
private PhysicalTypeMetadata getPhysicalTypeMetadata(final JavaType javaType) { final String declaredByMetadataId = typeLocationService .getPhysicalTypeIdentifier(javaType); if (StringUtils.isBlank(declaredByMetadataId)) { return null; } return (PhysicalTypeMetadata) getMetadataService().get(declaredByMetadataId); }
@Override public void focus(final JavaType type) { Validate.notNull(type, "Specify the type to focus on"); final String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(type); Validate.notNull(physicalTypeIdentifier, "Cannot locate the type %s", type.getFullyQualifiedTypeName()); final PhysicalTypeMetadata ptm = (PhysicalTypeMetadata) metadataService.get(physicalTypeIdentifier); Validate.notNull(ptm, "Class %s does not exist", PhysicalTypeIdentifier.getFriendlyName(physicalTypeIdentifier)); }
final String superclassId = typeLocationService.getPhysicalTypeIdentifier(superclass); PhysicalTypeMetadata superPtm = null; if (superclassId != null) {
private void registerDependencyUponType(final String entityFactoryMetadata, final JavaType type) { final String fieldPhysicalTypeId = getTypeLocationService().getPhysicalTypeIdentifier(type); getMetadataDependencyRegistry().registerDependency(fieldPhysicalTypeId, entityFactoryMetadata); }
/** * Returns details of the given Java type's members * * @param type the type for which to get the members (required) * @return <code>null</code> if the member details are unavailable */ protected MemberDetails getMemberDetails(final JavaType type) { TypeLocationService typeLocationService = getTypeLocationService(); Validate.notNull(typeLocationService, "TypeLocationService is required"); final String physicalTypeIdentifier = typeLocationService.getPhysicalTypeIdentifier(type); if (physicalTypeIdentifier == null) { return null; } // We need to lookup the metadata we depend on final PhysicalTypeMetadata physicalTypeMetadata = (PhysicalTypeMetadata) getMetadataService().get(physicalTypeIdentifier); return getMemberDetails(physicalTypeMetadata); }