Skip to content

Commit 2eadb1c

Browse files
author
Oleksii Tymchenko
authored
Merge branch 'master' into 0.7-and-artifact-id-change
2 parents 217170b + d3a4ced commit 2eadb1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+768
-478
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/main/java/org/spine3/base/Commands.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.spine3.client.CommandFactory;
3131
import org.spine3.protobuf.AnyPacker;
3232
import org.spine3.protobuf.Timestamps;
33-
import org.spine3.protobuf.TypeUrl;
33+
import org.spine3.protobuf.TypeName;
3434
import org.spine3.time.ZoneOffset;
3535
import org.spine3.users.TenantId;
3636
import org.spine3.users.UserId;
@@ -229,8 +229,7 @@ public static String formatMessageTypeAndId(String format, Message commandMessag
229229
checkNotNull(format);
230230
checkNotEmptyOrBlank(format, "format string");
231231

232-
final String cmdType = TypeUrl.of(commandMessage)
233-
.getTypeName();
232+
final String cmdType = TypeName.of(commandMessage);
234233
final String id = idToString(commandId);
235234
final String result = String.format(format, cmdType, id);
236235
return result;

client/src/main/java/org/spine3/base/Events.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.google.protobuf.Timestamp;
2828
import org.spine3.protobuf.AnyPacker;
2929
import org.spine3.protobuf.Timestamps;
30-
import org.spine3.protobuf.TypeUrl;
30+
import org.spine3.protobuf.TypeName;
3131
import org.spine3.users.UserId;
3232

3333
import javax.annotation.Nullable;
@@ -275,8 +275,7 @@ public static <E extends Message> Optional<E> getEnrichment(Class<E> enrichmentC
275275
return Optional.absent();
276276
}
277277
final Enrichments enrichments = value.get();
278-
final String typeName = TypeUrl.of(enrichmentClass)
279-
.getTypeName();
278+
final String typeName = TypeName.of(enrichmentClass);
280279
final Any any = enrichments.getMapMap()
281280
.get(typeName);
282281
if (any == null) {

client/src/main/java/org/spine3/base/FailureThrowable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public abstract class FailureThrowable extends Throwable {
4040
private final Timestamp timestamp;
4141

4242
protected FailureThrowable(GeneratedMessageV3 failure) {
43+
super();
4344
this.failure = failure;
4445
this.timestamp = getCurrentTime();
4546
}

client/src/main/java/org/spine3/base/Queries.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.spine3.client.Target;
3030
import org.spine3.protobuf.AnyPacker;
3131
import org.spine3.protobuf.KnownTypes;
32+
import org.spine3.protobuf.TypeName;
3233
import org.spine3.protobuf.TypeUrl;
3334

3435
import javax.annotation.Nullable;
@@ -191,11 +192,9 @@ public static Target allOf(Class<? extends Message> entityClass) {
191192
return result;
192193
}
193194

194-
/* package */
195-
static Target composeTarget(Class<? extends Message> entityClass, @Nullable Set<? extends Message> ids) {
196-
final TypeUrl type = TypeUrl.of(entityClass);
197-
198-
final boolean includeAll = ids == null;
195+
/* package */ static Target composeTarget(Class<? extends Message> entityClass,
196+
@Nullable Set<? extends Message> ids) {
197+
final boolean includeAll = (ids == null);
199198

200199
final EntityIdFilter.Builder idFilterBuilder = EntityIdFilter.newBuilder();
201200

@@ -213,7 +212,7 @@ static Target composeTarget(Class<? extends Message> entityClass, @Nullable Set<
213212
.setIdFilter(idFilter)
214213
.build();
215214
final Target.Builder builder = Target.newBuilder()
216-
.setType(type.getTypeName());
215+
.setType(TypeName.of(entityClass));
217216
if (includeAll) {
218217
builder.setIncludeAll(true);
219218
} else {

client/src/main/java/org/spine3/change/Mismatches.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@
3030
*/
3131
/* package */ class Mismatches {
3232

33+
private static final String ERR_CANNOT_BE_EQUAL = "`expected` and `actual` cannot be equal in ValueMismatch";
34+
3335
private Mismatches() {
3436
// Prevent instantiations.
3537
}
3638

3739
/* package */ static void checkNotNullOrEqual(Object expected, Object actual) {
3840
checkNotNull(expected);
3941
checkNotNull(actual);
40-
checkArgument(!expected.equals(actual), ErrorMessage.EXPECTED_AND_ACTUAL_CANNOT_BE_EQUAL);
42+
checkArgument(!expected.equals(actual), ERR_CANNOT_BE_EQUAL);
4143
}
4244
}

client/src/main/java/org/spine3/client/ConnectionConstants.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@
2525
*
2626
* @author Alexander Yevsyukov
2727
*/
28-
public interface ConnectionConstants {
28+
public class ConnectionConstants {
2929

30-
/** The default port number on which a client server runs. */
31-
int DEFAULT_CLIENT_SERVICE_PORT = 50051;
30+
/**
31+
* The default port number on which a client server runs.
32+
*/
33+
public static final int DEFAULT_CLIENT_SERVICE_PORT = 50051;
3234

35+
private ConnectionConstants() {
36+
// Prevent instantiation.
37+
}
3338
}

client/src/main/java/org/spine3/protobuf/AnyPacker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ private AnyPacker() {}
4545
* @return the instance of {@link Any} object that wraps given message
4646
*/
4747
public static Any pack(Message message) {
48-
final TypeUrl typeUrl = TypeUrl.of(message.getDescriptorForType());
48+
final TypeUrl typeUrl = TypeUrl.from(message.getDescriptorForType());
4949
final String typeUrlPrefix = typeUrl.getPrefix();
5050
final Any result = Any.pack(message, typeUrlPrefix);
5151
return result;

client/src/main/java/org/spine3/protobuf/KnownTypes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private void put(Class<? extends GeneratedMessageV3> clazz) {
309309
}
310310

311311
private void putEnum(EnumDescriptor desc, Class<? extends EnumLite> enumClass) {
312-
final TypeUrl typeUrl = TypeUrl.of(desc);
312+
final TypeUrl typeUrl = TypeUrl.from(desc);
313313
final ClassName className = ClassName.of(enumClass);
314314
put(typeUrl, className);
315315
}

client/src/main/java/org/spine3/protobuf/Messages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public static Class<?> getFieldClass(FieldDescriptor field) {
177177
final Class<? extends Message> enumClass = toMessageClass(TypeUrl.of(enumTypeName));
178178
return enumClass;
179179
case MESSAGE:
180-
final TypeUrl typeUrl = TypeUrl.of(field.getMessageType());
180+
final TypeUrl typeUrl = TypeUrl.from(field.getMessageType());
181181
final Class<? extends Message> msgClass = toMessageClass(typeUrl);
182182
return msgClass;
183183
default:

0 commit comments

Comments
 (0)