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:
committed by
Ilkka Seppälä
parent
1fdc650545
commit
271d7ae9bd
@ -28,25 +28,23 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Property pattern is also known as Prototype inheritance.
|
||||
* <p>
|
||||
* In prototype inheritance instead of classes, as opposite to Java class inheritance, objects are
|
||||
* used to create another objects and object hierarchies. Hierarchies are created using prototype
|
||||
* chain through delegation: every object has link to parent object. Any base (parent) object can be
|
||||
* amended at runtime (by adding or removal of some property), and all child objects will be
|
||||
* affected as result.
|
||||
* <p>
|
||||
* In this example we demonstrate {@link Character} instantiation using the Property pattern.
|
||||
*
|
||||
*
|
||||
* <p>In prototype inheritance instead of classes, as opposite to Java class inheritance, objects
|
||||
* are used to create another objects and object hierarchies. Hierarchies are created using
|
||||
* prototype chain through delegation: every object has link to parent object. Any base (parent)
|
||||
* object can be amended at runtime (by adding or removal of some property), and all child objects
|
||||
* will be affected as result.
|
||||
*
|
||||
* <p>In this example we demonstrate {@link Character} instantiation using the Property pattern.
|
||||
*/
|
||||
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) {
|
||||
|
@ -32,7 +32,7 @@ import java.util.Map;
|
||||
public class Character implements Prototype {
|
||||
|
||||
/**
|
||||
* Enumeration of Character types
|
||||
* Enumeration of Character types.
|
||||
*/
|
||||
public enum Type {
|
||||
WARRIOR, MAGE, ROGUE
|
||||
@ -45,26 +45,28 @@ public class Character implements Prototype {
|
||||
private Type type;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*/
|
||||
public Character() {
|
||||
this.prototype = new Prototype() { // Null-value object
|
||||
@Override
|
||||
public Integer get(Stats stat) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Integer get(Stats stat) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(Stats stat) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean has(Stats stat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(Stats stat, Integer val) {}
|
||||
@Override
|
||||
public void set(Stats stat, Integer val) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(Stats stat) {}
|
||||
};
|
||||
@Override
|
||||
public void remove(Stats stat) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Character(Type type, Prototype prototype) {
|
||||
@ -73,7 +75,7 @@ public class Character implements Prototype {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*/
|
||||
public Character(String name, Character prototype) {
|
||||
this.name = name;
|
||||
|
@ -24,7 +24,7 @@
|
||||
package com.iluwatar.property;
|
||||
|
||||
/**
|
||||
* Interface for prototype inheritance
|
||||
* Interface for prototype inheritance.
|
||||
*/
|
||||
public interface Prototype {
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
package com.iluwatar.property;
|
||||
|
||||
/**
|
||||
* All possible attributes that Character can have
|
||||
* All possible attributes that Character can have.
|
||||
*/
|
||||
public enum Stats {
|
||||
|
||||
|
Reference in New Issue
Block a user