The following document contains the results of PMD's CPD 4.3.
File | Line |
---|---|
de\smartics\maven\exceptions\scan\TagInfo.java | 31 |
de\smartics\maven\exceptions\sdoc\TagInfo.java | 31 |
class TagInfo { // ********************************* Fields ********************************* // --- constants ------------------------------------------------------------ // --- members -------------------------------------------------------------- /** * The information extracted from the all level Javadoc tag * <code>sdoc.category</code>. */ private final String category; /** * The information extracted from the all level Javadoc tag * <code>sdoc.subcategory</code>. */ private final String subcategory; /** * The information extracted from the all level Javadoc tag * <code>sdoc.tag</code> that may appear multiple times. */ private final List<String> tags = new ArrayList<String>(); /** * The information extracted from the all level Javadoc tag * <code>sdoc.parent</code> that may appear multiple times. */ private final List<String> parents = new ArrayList<String>(); /** * The information extracted from the field level Javadoc tag * <code>sdoc.name</code>. */ private final String name; /** * The information extracted from the field level Javadoc tag * <code>sdoc.sort-key</code>. */ private final String sortKey; /** * The information extracted from the field level Javadoc tag * <code>sdoc.short-description</code>. */ private final String shortDescription; /** * The information extracted from the field level Javadoc tag * <code>sdoc.notes</code>. */ private final String notes; // ****************************** Initializer ******************************* // ****************************** Constructors ****************************** /** * Default constructor. */ public TagInfo(final JavaClass classDoc, final JavaField fieldDoc) { this.category = extractSingleValue(classDoc, fieldDoc, "sdoc.category"); this.subcategory = extractSingleValue(classDoc, fieldDoc, "sdoc.subcategory"); extractMultiValue(classDoc, "sdoc.tag", tags); extractMultiValue(fieldDoc, "sdoc.tag", tags); extractMultiValue(classDoc, "sdoc.parent", parents); extractMultiValue(fieldDoc, "sdoc.parent", parents); this.name = extractSingleValue(fieldDoc, "sdoc.name"); this.sortKey = extractSingleValue(fieldDoc, "sdoc.sort-key"); this.shortDescription = extractSingleValue(fieldDoc, "sdoc.short-description"); this.notes = extractSingleValue(fieldDoc, "sdoc.notes"); } // ****************************** Inner Classes ***************************** // ********************************* Methods ******************************** // --- init ----------------------------------------------------------------- private String extractSingleValue(final JavaAnnotatedElement doc1, final JavaAnnotatedElement doc2, final String name) { String value = extractSingleValue(doc2, name); if (StringUtils.isBlank(value)) { value = extractSingleValue(doc1, name); } return value; } private String extractSingleValue(final JavaAnnotatedElement doc, final String name) { final List<DocletTag> tags = doc.getTagsByName(name); if (!tags.isEmpty()) { final String text = tags.get(0).getValue(); if (StringUtils.isNotBlank(text)) { return text; } } return null; } private void extractMultiValue(final JavaAnnotatedElement doc, final String name, final List<String> list) { final List<DocletTag> tags = doc.getTagsByName(name); for (final DocletTag tag : tags) { final String text = tag.getValue(); if (StringUtils.isNotBlank(text)) { list.add(text); } } } // --- get&set -------------------------------------------------------------- /** * Returns the information extracted from the type level Javadoc tag * <code>sdoc.category</code>. * * @return the information extracted from the type level Javadoc tag * <code>sdoc</code>. */ public String getCategory() { return category; } /** * Returns the information extracted from the type level Javadoc tag * <code>sdoc.subcategory</code>. * * @return the information extracted from the type level Javadoc tag * <code>sdoc</code>. */ public String getSubcategory() { return subcategory; } /** * Returns the information extracted from the all level Javadoc tag * <code>sdoc.tag</code> that may appear multiple times. * * @return the information extracted from the all level Javadoc tag * <code>sdoc</code>. */ public List<String> getTags() { return tags; } /** * Returns the information extracted from the all level Javadoc tag * <code>sdoc.parent</code> that may appear multiple times. * * @return the information extracted from the all level Javadoc tag * <code>sdoc</code>. */ public List<String> getParents() { return parents; } /** * Returns the information extracted from the field level Javadoc tag * <code>sdoc.name</code>. * * @return the information extracted from the field level Javadoc tag * <code>sdoc</code>. */ public String getName() { return name; } /** * Returns the information extracted from the field level Javadoc tag * <code>sdoc.sort-key</code>. * * @return the information extracted from the field level Javadoc tag * <code>sdoc</code>. */ public String getSortKey() { return sortKey; } /** * Returns the information extracted from the field level Javadoc tag * <code>sdoc.short-description</code>. * * @return the information extracted from the field level Javadoc tag * <code>sdoc</code>. */ public String getShortDescription() { return shortDescription; } /** * Returns the information extracted from the field level Javadoc tag * <code>sdoc.notes</code>. * * @return the information extracted from the field level Javadoc tag * <code>sdoc</code>. */ public String getNotes() { return notes; } // --- business ------------------------------------------------------------- // --- object basics -------------------------------------------------------- } |
File | Line |
---|---|
de\smartics\maven\exceptions\report\CodeSortedSinkReportGenerator.java | 71 |
de\smartics\maven\exceptions\report\ComponentCodeSortedSinkReportGenerator.java | 72 |
Collections.sort(items, new MixedCodeComparator()); return items; } @Override protected String getCurrentSelection(final ExceptionCodeReportItem item) { final Code code = item.getCode(); if (code instanceof NumberCode) { final NumberCode numberCode = (NumberCode) code; final String codeMajorNumber = String.valueOf(numberCode.getMajorNumber()); return codeMajorNumber; } return code.getComponentId(); } @Override protected boolean hasSectionChanged(String currentSection, final ExceptionCodeReportItem item) { final Code code = item.getCode(); boolean headerChanged; if (code instanceof NumberCode) { final NumberCode numberCode = (NumberCode) code; final String codeMajorNumber = String.valueOf(numberCode.getMajorNumber()); headerChanged = !ObjectUtils.equals(currentSection, codeMajorNumber); } else { final String componentId = code.getComponentId(); headerChanged = !ObjectUtils.equals(currentSection, componentId); } return headerChanged; } @Override protected String getCodeTitle(final String headLine, final ExceptionCodeReportItem item) { final String title; if (headLine != null) { title = headLine; } else { final String code = item.getCode().getCode(); |
File | Line |
---|---|
de\smartics\maven\exceptions\conf\DefaultJavadocProjectConfiguration.java | 177 |
de\smartics\maven\exceptions\conf\DefaultProjectConfiguration.java | 287 |
public Builder(final String projectName) { this.projectName = projectName; } // ***************************** Inner Classes **************************** // ******************************** Methods ******************************* // --- init --------------------------------------------------------------- // --- get&set ------------------------------------------------------------ /** * Sets the classpath used by the tool. * * @param toolClassPath the classpath used by the tool. */ public void setToolClassPath(final List<String> toolClassPath) { this.toolClassPath = toolClassPath; } /** * Sets the list of class path root elements of this project. * * @param classRootDirectoryNames the list of class path root elements of * this project. */ public void setClassRootDirectoryNames( final Collection<String> classRootDirectoryNames) { this.classRootDirectoryNames = classRootDirectoryNames; } /** * Sets the list of source path root elements of this project. * * @param sourceRootDirectoryNames the list of source path root elements of * this project. */ public void setSourceRootDirectoryNames( final Collection<String> sourceRootDirectoryNames) { this.sourceRootDirectoryNames = sourceRootDirectoryNames; } /** * Sets the includes for the scanner. * * @param includes the includes for the scanner. */ public void setIncludes(final List<String> includes) { this.includes = includes; } /** * Sets the excludes for the scanner. * * @param excludes the excludes for the scanner. */ public void setExcludes(final List<String> excludes) { this.excludes = excludes; } /** * Sets the encoding of the source files in this project. * * @param sourceEncoding the encoding of the source files in this project. */ public void setSourceEncoding(final String sourceEncoding) { this.sourceEncoding = sourceEncoding; } /** * Sets the encoding of the source files in this project. Defaults to * <code>1.5</code>. * * @param sourceVersion the encoding of the source files in this project. */ public void setSourceVersion(final String sourceVersion) { this.sourceVersion = sourceVersion; } // --- business ----------------------------------------------------------- /** * Creates the project configuration. * * @return the project configuration. * @throws IllegalArgumentException if any property is not valid. */ public JavadocProjectConfiguration build() throws IllegalArgumentException |
File | Line |
---|---|
de\smartics\maven\exceptions\AbstractSdocCodeMojo.java | 371 |
de\smartics\maven\exceptions\ExceptionCodeReport.java | 247 |
final Locale locale, final File outputDir) throws DependencyResolutionRequiredException { final List<String> classRootDirectoryNames = project.getCompileClasspathElements(); final List<String> sourceRootDirectoryNames = new ArrayList<String>(); sourceRootDirectoryNames.addAll(StringFunction.split( this.additionalSources, ",")); sourceRootDirectoryNames.addAll(project.getCompileSourceRoots()); sourceRootDirectoryNames.addAll(ConfigUtils .discoverSourceJars(classRootDirectoryNames)); final List<String> toolClassPath = PathUtils.toClassPath(pluginArtifacts); final Log log = getLog(); if (log.isDebugEnabled()) { log.debug("Tool class path: " + toolClassPath); log.debug("Class roots : " + classRootDirectoryNames); log.debug("Source roots : " + sourceRootDirectoryNames); } final DefaultProjectConfiguration.Builder<File> builder = |
File | Line |
---|---|
de\smartics\maven\exceptions\AbstractSdocCodeMojo.java | 418 |
de\smartics\maven\exceptions\ExceptionCodeReport.java | 298 |
final ProjectConfiguration<File> projectConfig) { final ReportConfiguration reportConfig = new ReportConfiguration(); reportConfig.setEncoding(this.sourceEncoding); final ProjectClassLoader classLoader = new ProjectClassLoader(Thread.currentThread().getContextClassLoader(), projectConfig.getClassRootDirectoryNames()); reportConfig.setProjectClassLoader(classLoader); for (final String name : projectConfig.getSourceRootDirectoryNames()) { final File file = new File(name); reportConfig.addSourceTree(file); } reportConfig.addIncludes(projectConfig.getIncludes()); reportConfig.addExcludes(projectConfig.getExcludes()); return reportConfig; } |