Sonar Fixes - public final class with private constructor for examples

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1875902 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alain Béarez 2020-03-31 01:16:39 +00:00
parent c67d2605fd
commit 65990027e1
17 changed files with 35 additions and 15 deletions

View File

@ -32,6 +32,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
* Demonstrates how you can extract data from a .pptx file
*/
public final class DataExtraction {
private DataExtraction() {}
public static void main(String[] args) throws IOException, OpenXML4JException {

View File

@ -26,6 +26,7 @@ import java.io.FileOutputStream;
* Merge multiple pptx presentations together
*/
public final class MergePresentations {
private MergePresentations() {}
public static void main(String[] args) throws Exception {
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -38,7 +38,9 @@ import org.apache.poi.xddf.usermodel.chart.XDDFPieChartData;
/**
* Build a pie chart from a template pptx
*/
public class PieChartDemo {
public final class PieChartDemo {
private PieChartDemo() {}
private static void usage(){
System.out.println("Usage: PieChartDemo <pie-chart-template.pptx> <pie-chart-data.txt>");
System.out.println(" pie-chart-template.pptx template with a pie chart");

View File

@ -26,7 +26,8 @@ import java.io.IOException;
* Demonstrates how to create slides with predefined layout
* and fill the placeholder shapes
*/
public class Tutorial1 {
public final class Tutorial1 {
private Tutorial1() {}
public static void main(String[] args) throws IOException{
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -27,7 +27,8 @@ import java.io.IOException;
/**
* Basic paragraph and text formatting
*/
public class Tutorial2 {
public final class Tutorial2 {
private Tutorial2() {}
public static void main(String[] args) throws IOException{
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -28,7 +28,8 @@ import org.apache.poi.sl.usermodel.Placeholder;
/**
* How to set slide title
*/
public class Tutorial3 {
public final class Tutorial3 {
private Tutorial3() {}
public static void main(String[] args) throws IOException{
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -30,7 +30,8 @@ import org.apache.poi.sl.usermodel.TextParagraph.TextAlign;
/**
* PPTX Tables
*/
public class Tutorial4 {
public final class Tutorial4 {
private Tutorial4() {}
public static void main(String[] args) throws IOException{
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -28,7 +28,8 @@ import org.apache.poi.sl.usermodel.PictureData.PictureType;
/**
* Images
*/
public class Tutorial5 {
public final class Tutorial5 {
private Tutorial5() {}
public static void main(String[] args) throws IOException{
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -26,7 +26,8 @@ import java.io.IOException;
/**
* Hyperlinks
*/
public class Tutorial6 {
public final class Tutorial6 {
private Tutorial6() {}
public static void main(String[] args) throws IOException{
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -29,7 +29,8 @@ import org.apache.poi.sl.usermodel.AutoNumberingScheme;
/**
* Bullets and numbering
*/
public class Tutorial7 {
public final class Tutorial7 {
private Tutorial7() {}
public static void main(String[] args) throws IOException {
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -31,7 +31,8 @@ import org.apache.poi.xslf.usermodel.XSLFTextShape;
/**
* Reading a .pptx presentation and printing basic shape properties
*/
public class Step1 {
public final class Step1 {
private Step1() {}
public static void main(String[] args) throws Exception {
if(args.length == 0) {

View File

@ -31,7 +31,9 @@ import java.io.FileOutputStream;
/**
* Create slides from pre-defined slide layouts
*/
public class Step2 {
public final class Step2 {
private Step2() {}
public static void main(String[] args) throws Exception{
try (XMLSlideShow ppt = new XMLSlideShow()) {

View File

@ -48,7 +48,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* Line chart example.
*/
public class BarChart {
public final class BarChart {
private BarChart() {}
public static void main(String[] args) throws IOException {
try (XSSFWorkbook wb = new XSSFWorkbook()) {

View File

@ -62,7 +62,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
* @see <a href="https://stackoverflow.com/questions/50873700/">Change axis color and font of the chart in openxmlformats</a>
* @see <a href="https://stackoverflow.com/questions/51530552/">Change colors of line chart Apache POI</a>
*/
class ExcelChartWithTargetLine {
public final class ExcelChartWithTargetLine {
private ExcelChartWithTargetLine() {}
private static final int NUM_OF_ROWS = 6;

View File

@ -49,7 +49,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* Line chart example.
*/
public class LineChart {
public final class LineChart {
private LineChart() {}
public static void main(String[] args) throws IOException {
try (XSSFWorkbook wb = new XSSFWorkbook()) {

View File

@ -50,7 +50,8 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* Illustrates how to create a simple scatter chart.
*/
public class ScatterChart {
public final class ScatterChart {
private ScatterChart() {}
public static void main(String[] args) throws IOException {
try (XSSFWorkbook wb = new XSSFWorkbook()) {

View File

@ -43,7 +43,9 @@ import org.apache.poi.xwpf.usermodel.XWPFDocument;
/**
* Build a bar chart from a template docx
*/
public class BarChartExample {
public final class BarChartExample {
private BarChartExample() {}
private static void usage(){
System.out.println("Usage: BarChartExample <bar-chart-template.docx> <bar-chart-data.txt>");
System.out.println(" bar-chart-template.docx template with a bar chart");