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

@ -27,41 +27,43 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* The Prototype pattern is a creational design pattern in software development. It is used when the
* type of objects to create is determined by a prototypical instance, which is cloned to produce
* new objects. This pattern is used to: - avoid subclasses of an object creator in the client
* application, like the abstract factory pattern does. - avoid the inherent cost of creating a new
* object in the standard way (e.g., using the 'new' keyword)
* <p>
* In this example we have a factory class ({@link HeroFactoryImpl}) producing objects by cloning
* the existing ones. The factory's prototype objects are given as constructor parameters.
*
*
* <p>In this example we have a factory class ({@link HeroFactoryImpl}) producing objects by
* cloning the existing ones. The factory's prototype objects are given as constructor parameters.
*/
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point
*
* Program entry point.
*
* @param args command line args
*/
public static void main(String[] args) {
HeroFactory factory;
Mage mage;
Warlord warlord;
Beast beast;
factory = new HeroFactoryImpl(new ElfMage("cooking"), new ElfWarlord("cleaning"), new ElfBeast("protecting"));
mage = factory.createMage();
warlord = factory.createWarlord();
beast = factory.createBeast();
HeroFactory factory = new HeroFactoryImpl(
new ElfMage("cooking"),
new ElfWarlord("cleaning"),
new ElfBeast("protecting")
);
Mage mage = factory.createMage();
Warlord warlord = factory.createWarlord();
Beast beast = factory.createBeast();
LOGGER.info(mage.toString());
LOGGER.info(warlord.toString());
LOGGER.info(beast.toString());
factory = new HeroFactoryImpl(new OrcMage("axe"), new OrcWarlord("sword"), new OrcBeast("laser"));
factory =
new HeroFactoryImpl(
new OrcMage("axe"),
new OrcWarlord("sword"),
new OrcBeast("laser")
);
mage = factory.createMage();
warlord = factory.createWarlord();
beast = factory.createBeast();

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* Beast
*
* Beast.
*/
public abstract class Beast extends Prototype {

View File

@ -24,12 +24,10 @@
package com.iluwatar.prototype;
/**
*
* ElfBeast
*
* ElfBeast.
*/
public class ElfBeast extends Beast {
private String helpType;
public ElfBeast(String helpType) {

View File

@ -24,15 +24,13 @@
package com.iluwatar.prototype;
/**
*
* ElfMage
*
* ElfMage.
*/
public class ElfMage extends Mage {
private String helpType;
public ElfMage(String helpType) {
this.helpType = helpType;
}

View File

@ -24,14 +24,12 @@
package com.iluwatar.prototype;
/**
*
* ElfWarlord
*
* ElfWarlord.
*/
public class ElfWarlord extends Warlord {
private String helpType;
public ElfWarlord(String helpType) {
this.helpType = helpType;
}

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* Interface for the factory class.
*
*/
public interface HeroFactory {

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* Concrete factory class.
*
*/
public class HeroFactoryImpl implements HeroFactory {
@ -35,7 +33,7 @@ public class HeroFactoryImpl implements HeroFactory {
private Beast beast;
/**
* Constructor
* Constructor.
*/
public HeroFactoryImpl(Mage mage, Warlord warlord, Beast beast) {
this.mage = mage;
@ -44,7 +42,7 @@ public class HeroFactoryImpl implements HeroFactory {
}
/**
* Create mage
* Create mage.
*/
public Mage createMage() {
try {
@ -55,7 +53,7 @@ public class HeroFactoryImpl implements HeroFactory {
}
/**
* Create warlord
* Create warlord.
*/
public Warlord createWarlord() {
try {
@ -66,7 +64,7 @@ public class HeroFactoryImpl implements HeroFactory {
}
/**
* Create beast
* Create beast.
*/
public Beast createBeast() {
try {

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* Mage
*
* Mage.
*/
public abstract class Mage extends Prototype {

View File

@ -24,18 +24,16 @@
package com.iluwatar.prototype;
/**
*
* OrcBeast
*
* OrcBeast.
*/
public class OrcBeast extends Beast {
private String weapon;
public OrcBeast(String weapon) {
this.weapon = weapon;
}
public OrcBeast(OrcBeast orcBeast) {
this.weapon = orcBeast.weapon;
}
@ -49,6 +47,6 @@ public class OrcBeast extends Beast {
public String toString() {
return "Orcish wolf attacks with " + weapon;
}
}

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* OrcMage
*
* OrcMage.
*/
public class OrcMage extends Mage {
@ -35,7 +33,7 @@ public class OrcMage extends Mage {
public OrcMage(String weapon) {
this.weapon = weapon;
}
public OrcMage(OrcMage orcMage) {
this.weapon = orcMage.weapon;
}

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* OrcWarlord
*
* OrcWarlord.
*/
public class OrcWarlord extends Warlord {
@ -35,7 +33,7 @@ public class OrcWarlord extends Warlord {
public OrcWarlord(String weapon) {
this.weapon = weapon;
}
public OrcWarlord(OrcWarlord orcWarlord) {
this.weapon = orcWarlord.weapon;
}

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* Prototype
*
* Prototype.
*/
public abstract class Prototype implements Cloneable {

View File

@ -24,9 +24,7 @@
package com.iluwatar.prototype;
/**
*
* Warlord
*
* Warlord.
*/
public abstract class Warlord extends Prototype {