#1021 enforce Checkstyle rules in the build

This commit is contained in:
Ilkka Seppälä
2019-11-16 16:00:24 +02:00
parent 9e58edf05e
commit 8747f1fd7a
17 changed files with 239 additions and 208 deletions
@@ -20,6 +20,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.roleobject;
import java.util.Optional;
@@ -29,51 +30,52 @@ import java.util.Optional;
*/
public abstract class Customer {
/**
* Add specific role @see {@link Role}
*
* @param role to add
* @return true if the operation has been successful otherwise false
*/
public abstract boolean addRole(Role role);
/**
* Add specific role @see {@link Role}.
* @param role to add
* @return true if the operation has been successful otherwise false
*/
public abstract boolean addRole(Role role);
/**
* Check specific role @see {@link Role}
*
* @param role to check
* @return true if the role exists otherwise false
*/
/**
* Check specific role @see {@link Role}.
* @param role to check
* @return true if the role exists otherwise false
*/
public abstract boolean hasRole(Role role);
public abstract boolean hasRole(Role role);
/**
* Remove specific role @see {@link Role}
*
* @param role to remove
* @return true if the operation has been successful otherwise false
*/
public abstract boolean remRole(Role role);
/**
* Remove specific role @see {@link Role}.
* @param role to remove
* @return true if the operation has been successful otherwise false
*/
public abstract boolean remRole(Role role);
/**
* Get specific instance associated with this role @see {@link Role}
*
* @param role to get
* @param expectedRole instance class expected to get
* @return optional with value if the instance exists and corresponds expected class
*/
public abstract <T extends Customer> Optional<T> getRole(Role role, Class<T> expectedRole);
/**
* Get specific instance associated with this role @see {@link Role}.
* @param role to get
* @param expectedRole instance class expected to get
* @return optional with value if the instance exists and corresponds expected class
*/
public abstract <T extends Customer> Optional<T> getRole(Role role, Class<T> expectedRole);
public static Customer newCustomer() {
return new CustomerCore();
}
public static Customer newCustomer(Role... role) {
Customer customer = newCustomer();
for (Role r : role) {
customer.addRole(r);
}
return customer;
public static Customer newCustomer() {
return new CustomerCore();
}
/**
* Create {@link Customer} with given roles.
* @param role roles
* @return Customer
*/
public static Customer newCustomer(Role... role) {
Customer customer = newCustomer();
for (Role r : role) {
customer.addRole(r);
}
return customer;
}
}