Resolves checkstyle errors for remaining p (#1091)

* Reduces checkstyle errors in page-object

* Reduces checkstyle errors in partial-response

* Reduces checkstyle errors in pipeline

* Reduces checkstyle errors in poison-pill

* Reduces checkstyle errors in priority-queue

* Reduces checkstyle errors in private-class-data

* Reduces checkstyle errors in property

* Reduces checkstyle errors in prototype

* Reduces checkstyle errors in proxy
This commit is contained in:
Anurag Agarwal
2019-11-16 18:26:26 +05:30
committed by Ilkka Seppälä
parent 1fdc650545
commit 271d7ae9bd
56 changed files with 281 additions and 313 deletions

View File

@ -24,26 +24,24 @@
package com.iluwatar.privateclassdata;
/**
*
* The Private Class Data design pattern seeks to reduce exposure of attributes by limiting their
* visibility. It reduces the number of class attributes by encapsulating them in single data
* object. It allows the class designer to remove write privilege of attributes that are intended to
* be set only during construction, even from methods of the target class.
* <p>
* In the example we have normal {@link Stew} class with some ingredients given in constructor. Then
* we have methods to enumerate the ingredients and to taste the stew. The method for tasting the
* stew alters the private members of the {@link Stew} class.
*
* The problem is solved with the Private Class Data pattern. We introduce {@link ImmutableStew}
* class that contains {@link StewData}. The private data members of {@link Stew} are now in
* {@link StewData} and cannot be altered by {@link ImmutableStew} methods.
*
* <p>In the example we have normal {@link Stew} class with some ingredients given in constructor.
* Then we have methods to enumerate the ingredients and to taste the stew. The method for tasting
* the stew alters the private members of the {@link Stew} class.
*
* <p>The problem is solved with the Private Class Data pattern. We introduce {@link ImmutableStew}
* class that contains {@link StewData}. The private data members of {@link Stew} are now in {@link
* StewData} and cannot be altered by {@link ImmutableStew} methods.
*/
public class App {
/**
* Program entry point
*
* Program entry point.
*
* @param args command line args
*/
public static void main(String[] args) {

View File

@ -27,9 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* Immutable stew class, protected with Private Class Data pattern
*
* Immutable stew class, protected with Private Class Data pattern.
*/
public class ImmutableStew {
@ -42,10 +40,11 @@ public class ImmutableStew {
}
/**
* Mix the stew
* Mix the stew.
*/
public void mix() {
LOGGER.info("Mixing the immutable stew we find: {} potatoes, {} carrots, {} meat and {} peppers",
data.getNumPotatoes(), data.getNumCarrots(), data.getNumMeat(), data.getNumPeppers());
LOGGER
.info("Mixing the immutable stew we find: {} potatoes, {} carrots, {} meat and {} peppers",
data.getNumPotatoes(), data.getNumCarrots(), data.getNumMeat(), data.getNumPeppers());
}
}

View File

@ -27,9 +27,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* Mutable stew class
*
* Mutable stew class.
*/
public class Stew {
@ -41,7 +39,7 @@ public class Stew {
private int numPeppers;
/**
* Constructor
* Constructor.
*/
public Stew(int numPotatoes, int numCarrots, int numMeat, int numPeppers) {
this.numPotatoes = numPotatoes;
@ -51,7 +49,7 @@ public class Stew {
}
/**
* Mix the stew
* Mix the stew.
*/
public void mix() {
LOGGER.info("Mixing the stew we find: {} potatoes, {} carrots, {} meat and {} peppers",
@ -59,7 +57,7 @@ public class Stew {
}
/**
* Taste the stew
* Taste the stew.
*/
public void taste() {
LOGGER.info("Tasting the stew");

View File

@ -24,9 +24,7 @@
package com.iluwatar.privateclassdata;
/**
*
* Stew ingredients
*
* Stew ingredients.
*/
public class StewData {
@ -36,7 +34,7 @@ public class StewData {
private int numPeppers;
/**
* Constructor
* Constructor.
*/
public StewData(int numPotatoes, int numCarrots, int numMeat, int numPeppers) {
this.numPotatoes = numPotatoes;