public ResourcePermission(String resource, String operation, String target, String key) { // what's eventually stored are either "*", "NULL" or a valid enum except ALL. // Fields are never null. this.resource = parsePart(resource, r -> Resource.valueOf(r).getName()); this.operation = parsePart(operation, o -> Operation.valueOf(o).getName()); if (target != null) { this.target = StringUtils.stripStart(target, Region.SEPARATOR); } if (key != null) { this.key = key; } setParts(this.resource + ":" + this.operation + ":" + this.target + ":" + this.key, true); }