本文整理汇总了Java中org.sonar.api.resources.Project.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Project.getProperty方法的具体用法?Java Project.getProperty怎么用?Java Project.getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sonar.api.resources.Project
的用法示例。
在下文中一共展示了Project.getProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkXmlFile
import org.sonar.api.resources.Project; //导入方法依赖的package包/类
private void checkXmlFile(final Project project, final SensorContext sensorContext, final org.sonar.api.resources.File beanFile) {
String sourceDirectory = (String) project.getProperty(SpringPlugin.SOURCE_DIRECTORY);
LOGGER.info("SpringSensor analyse sourceDirectory: " + sourceDirectory);
File springBeanDefinition = this.projectFileSystem.resolvePath(sourceDirectory + "/" + beanFile.getLongName());
org.springframework.core.io.Resource beanDefinitionsXML = new FileSystemResource(springBeanDefinition.getAbsolutePath());
int beanCount = beanDefinitionReader.loadBeanDefinitions(beanDefinitionsXML);
LOGGER.info("BeanClassCheck validate " + beanCount + " beans loaded.");
BeanDefinitionRegistry beanDefinitionRegistry = beanDefinitionReader.getRegistry();
String[] beanDefinitionNames = beanDefinitionRegistry.getBeanDefinitionNames();
for(String beanDefinitionName : beanDefinitionNames) {
LOGGER.info("BeanClassCheck validate beanDefinitionName: " + beanDefinitionName);
BeanDefinition beanDefinition = beanDefinitionRegistry.getBeanDefinition(beanDefinitionName);
BeanSourceCode beanSourceCode = new BeanSourceCode(beanFile, beanDefinition);
for(BeanCheck beanCheck : springChecks) {
LOGGER.info("SpringSensor analyse BeanCheck: " + beanCheck.getClass().getName());
beanCheck.validate(beanSourceCode, project);
}
LOGGER.info("SpringSensor analyse beanSourceCode.getViolations().size(): " + beanSourceCode.getViolations().size());
for (Violation violation : beanSourceCode.getViolations()) {
LOGGER.info("SpringSensor analyse violation.getMessage(): " + violation.getMessage());
sensorContext.saveViolation(violation);
}
}
}
示例2: getSourceDirs
import org.sonar.api.resources.Project; //导入方法依赖的package包/类
public static List<File> getSourceDirs(Project project) {
String sourceDir = (String) project.getProperty(SpringPlugin.SOURCE_DIRECTORY);
if (sourceDir != null) {
List<File> sourceDirs = new ArrayList<File>();
sourceDirs.add(project.getFileSystem().resolvePath(sourceDir));
return sourceDirs;
} else {
return project.getFileSystem().getSourceDirs();
}
}