@Override
public String toString() {
- final StringBuilder sb = new StringBuilder("IdentityAttributeRef{");
- sb.append("qNameOfIdentity='").append(qualifiedNameOfIdentity).append('\'');
- sb.append('}');
- return sb.toString();
+ return "IdentityAttributeRef{" + "qualifiedNameOfIdentity='" + qualifiedNameOfIdentity + "'}";
}
@Override
@Override
public String toString() {
- final StringBuilder sb = new StringBuilder("MappedDependency{");
- sb.append("namespace='").append(namespace).append('\'');
- sb.append(", serviceName='").append(serviceName).append('\'');
- sb.append(", refName='").append(refName).append('\'');
- sb.append('}');
- return sb.toString();
+ return "MappedDependency{"
+ + "namespace='" + namespace + '\''
+ + ", serviceName='" + serviceName + '\''
+ + ", refName='" + refName + '\''
+ + '}';
}
}
}
EditStrategyType defaultStrategy) throws OperationNotPermittedException {
if (defaultStrategy.isEnforcing()) {
if (parsedStrategy != defaultStrategy) {
- throw new OperationNotPermittedException(String.format("With " + defaultStrategy
- + " as default-operation operations on module elements are not permitted"
- + "since the default option is restrictive"),
- DocumentedException.ErrorType.APPLICATION, DocumentedException.ErrorTag.OPERATION_FAILED,
+ throw new OperationNotPermittedException("With " + defaultStrategy
+ + " as default-operation operations on module elements are not permitted since the default "
+ + "option is restrictive",
+ DocumentedException.ErrorType.APPLICATION,
+ DocumentedException.ErrorTag.OPERATION_FAILED,
DocumentedException.ErrorSeverity.ERROR);
}
}
@Override
public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("transactionName=");
- sb.append(getTransactionName());
- return sb.toString();
+ return "transactionName=" + getTransactionName();
}
// @VisibleForTesting
@Override
public String toString() {
- final StringBuilder sb = new StringBuilder("ConfigSnapshot{");
- sb.append("configSnapshot='").append(configXml).append('\'');
- sb.append(", capabilities=").append(capabilities);
- sb.append(", features=").append(features);
- sb.append('}');
- return sb.toString();
+ return "ConfigSnapshot{"
+ + "configSnapshot='" + configXml + '\''
+ + ", capabilities=" + capabilities
+ + ", features=" + features +
+ '}';
}
}
.getFullyQualifiedName(rootRB.getPackageName(), rootRB.getJavaNameOfRuntimeMXBean());
String childRegistratorFQN = rootFtlFile.getFullyQualifiedName();
Field rbParameter = new Field(fullyQualifiedNameOfMXBean, "rb");
- StringBuilder registerBody = new StringBuilder();
- registerBody.append(format("%s %s = this.%s.registerRoot(%s);\n",
- HierarchicalRuntimeBeanRegistration.class
- .getCanonicalName(), hierachicalRegistration
- .getName(), rootRuntimeBeanRegistratorField
- .getName(), rbParameter.getName()));
- registerBody.append(format("return new %s(%s);\n",
- rootFtlFile.getFullyQualifiedName(),
- hierachicalRegistration.getName()));
+ String registerBody = format("%s %s = this.%s.registerRoot(%s);\n"
+ + "return new %s(%2$s);\n",
+ HierarchicalRuntimeBeanRegistration.class.getCanonicalName(),
+ hierachicalRegistration.getName(),
+ rootRuntimeBeanRegistratorField.getName(),
+ rbParameter.getName(),
+ rootFtlFile.getFullyQualifiedName());
MethodDefinition registerMethod = new MethodDefinition(
childRegistratorFQN, "register",
- Collections.singletonList(rbParameter), registerBody.toString());
+ Collections.singletonList(rbParameter), registerBody);
methods.add(registerMethod);
}
}
private static String getCreateModule(FullyQualifiedName moduleFQN, List<Field> moduleFields) {
- String result = "\n"+
- "@Override\n"+
- format("public %s createModule(String instanceName, %s dependencyResolver, %s old, %s bundleContext) throws Exception {\n",
- Module.class.getCanonicalName(), DependencyResolver.class.getCanonicalName(),
- DynamicMBeanWithInstance.class.getCanonicalName(), BUNDLE_CONTEXT)+
- format("%s oldModule;\n",moduleFQN)+
- "try {\n"+
- format("oldModule = (%s) old.getModule();\n", moduleFQN)+
- "} catch(Exception e) {\n"+
- "return handleChangedClass(dependencyResolver, old, bundleContext);\n"+
- "}\n"+
- format("%s module = instantiateModule(instanceName, dependencyResolver, oldModule, old.getInstance(), bundleContext);\n", moduleFQN);
-
- for(Field field: moduleFields) {
- result += format("module.set%s(oldModule.get%1$s());\n", field.getName());
+ StringBuilder result = new StringBuilder("\n" +
+ "@Override\n");
+ result.append(
+ format("public %s createModule(String instanceName, %s dependencyResolver, %s old, %s bundleContext) "
+ + "throws Exception {\n",
+ Module.class.getCanonicalName(), DependencyResolver.class.getCanonicalName(),
+ DynamicMBeanWithInstance.class.getCanonicalName(), BUNDLE_CONTEXT))
+ .append(format("%s oldModule;\n", moduleFQN))
+ .append("try {\n")
+ .append(format("oldModule = (%s) old.getModule();\n", moduleFQN))
+ .append("} catch(Exception e) {\n"
+ + "return handleChangedClass(dependencyResolver, old, bundleContext);\n"
+ + "}\n")
+ .append(format("%s module = instantiateModule(instanceName, dependencyResolver, oldModule, old"
+ + ".getInstance(), bundleContext);\n",
+ moduleFQN));
+
+ for (Field field : moduleFields) {
+ result.append(format("module.set%s(oldModule.get%1$s());\n", field.getName()));
}
- result += "\n"+
- "return module;\n"+
- "}\n";
- return result;
+ result.append("\n"
+ + "return module;\n"
+ + "}\n");
+ return result.toString();
}
private static String getServiceIfcsInitialization(List<FullyQualifiedName> providedServices) {
String generic = format("Class<? extends %s>", AbstractServiceInterface.class.getCanonicalName());
- String result = "static {\n";
+ StringBuilder result = new StringBuilder("static {\n");
if (!providedServices.isEmpty()) {
- result += format("java.util.Set<%1$s> serviceIfcs2 = new java.util.HashSet<>();\n", generic);
+ result.append(format("java.util.Set<%1$s> serviceIfcs2 = new java.util.HashSet<>();\n", generic));
- for(FullyQualifiedName fqn: providedServices) {
- result += format("serviceIfcs2.add(%s.class);\n", fqn);
+ for (FullyQualifiedName fqn : providedServices) {
+ result.append(format("serviceIfcs2.add(%s.class);\n", fqn));
}
- result += "serviceIfcs = java.util.Collections.unmodifiableSet(serviceIfcs2);\n";
+ result.append("serviceIfcs = java.util.Collections.unmodifiableSet(serviceIfcs2);\n");
} else {
- result += "serviceIfcs = java.util.Collections.emptySet();\n";
+ result.append("serviceIfcs = java.util.Collections.emptySet();\n");
}
- result += "}\n";
+ result.append("}\n");
// add isModuleImplementingServiceInterface and getImplementedServiceIntefaces methods
- result += format("\n"+
- "@Override\n"+
- "public final boolean isModuleImplementingServiceInterface(Class<? extends %1$s> serviceInterface) {\n"+
- "for (Class<?> ifc: serviceIfcs) {\n"+
- "if (serviceInterface.isAssignableFrom(ifc)){\n"+
- "return true;\n"+
- "}\n"+
- "}\n"+
- "return false;\n"+
- "}\n"+
- "\n"+
- "@Override\n"+
- "public java.util.Set<Class<? extends %1$s>> getImplementedServiceIntefaces() {\n"+
- "return serviceIfcs;\n"+
- "}\n", AbstractServiceInterface.class.getCanonicalName());
-
- return result;
+ result.append(format("\n"
+ + "@Override\n"
+ + "public final boolean isModuleImplementingServiceInterface(Class<? extends %1$s> serviceInterface) "
+ + "{\n"
+ + "for (Class<?> ifc: serviceIfcs) {\n"
+ + "if (serviceInterface.isAssignableFrom(ifc)){\n"
+ + "return true;\n"
+ + "}\n"
+ + "}\n"
+ + "return false;\n"
+ + "}\n"
+ + "\n"
+ + "@Override\n"
+ + "public java.util.Set<Class<? extends %1$s>> getImplementedServiceIntefaces() {\n"
+ + "return serviceIfcs;\n"
+ + "}\n", AbstractServiceInterface.class.getCanonicalName()));
+
+ return result.toString();
}
}
}
private static String getMethods(List<? extends Method> methods) {
- String result = "\n// getters and setters\n";
- for(Method method: methods) {
- result += method.toString()+"\n";
+ StringBuilder result = new StringBuilder("\n// getters and setters\n");
+ for (Method method : methods) {
+ result.append(method).append("\n");
}
- return result;
+ return result.toString();
}
private static String getEqualsAndHashCode(FullyQualifiedName abstractFQN) {
}
private static String getReuseLogic(List<ModuleField> moduleFields, FullyQualifiedName abstractFQN) {
- String result = "\n"+
- format("public boolean canReuseInstance(%s oldModule){\n", abstractFQN.getTypeName())+
- "// allow reusing of old instance if no parameters was changed\n"+
- "return isSame(oldModule);\n"+
- "}\n"+
- "\n"+
- format("public %s reuseInstance(%1$s oldInstance){\n", AutoCloseable.class.getCanonicalName())+
- "// implement if instance reuse should be supported. Override canReuseInstance to change the criteria.\n"+
- "return oldInstance;\n"+
- "}\n";
+ StringBuilder result = new StringBuilder("\n" +
+ format("public boolean canReuseInstance(%s oldModule){\n", abstractFQN.getTypeName()) +
+ "// allow reusing of old instance if no parameters was changed\n" +
+ "return isSame(oldModule);\n" +
+ "}\n" +
+ "\n" +
+ format("public %s reuseInstance(%1$s oldInstance){\n", AutoCloseable.class.getCanonicalName()) +
+ "// implement if instance reuse should be supported." +
+ "Override canReuseInstance to change the criteria.\n" +
+ "return oldInstance;\n" +
+ "}\n");
// isSame method that detects changed fields
- result += "\n"+
- format("public boolean isSame(%s other) {\n", abstractFQN.getTypeName())+
- "if (other == null) {\n"+
- "throw new IllegalArgumentException(\"Parameter 'other' is null\");\n"+
- "}\n";
- // loop through fields, do deep equals on each field
+ result.append("\n")
+ .append(format("public boolean isSame(%s other) {\n", abstractFQN.getTypeName()))
+ .append("if (other == null) {\n")
+ .append("throw new IllegalArgumentException(\"Parameter 'other' is null\");\n")
+ .append("}\n");
+ // loop through fields, do deep equals on each field
for (ModuleField moduleField : moduleFields) {
- result += format(
- "if (!java.util.Objects.deepEquals(%s, other.%1$s)) {\n"+
- "return false;\n"+
- "}\n", moduleField.getName());
+ result.append(format(
+ "if (!java.util.Objects.deepEquals(%s, other.%1$s)) {\n" +
+ "return false;\n" +
+ "}\n", moduleField.getName()));
if (moduleField.isListOfDependencies()) {
- result += format(
- "for (int idx = 0; idx < %1$s.size(); idx++) {\n"+
- "if (!dependencyResolver.canReuseDependency(%1$s.get(idx), %1$sJmxAttribute)) {\n"+
- "return false;\n"+
- "}\n"+
- "}\n" , moduleField.getName());
+ result.append(format(
+ "for (int idx = 0; idx < %1$s.size(); idx++) {\n" +
+ "if (!dependencyResolver.canReuseDependency(%1$s.get(idx), %1$sJmxAttribute)) {\n" +
+ "return false;\n" +
+ "}\n" +
+ "}\n", moduleField.getName()));
} else if (moduleField.isDependent()) {
- result += format(
+ result.append(format(
// If a reference is null (ie optional reference) it makes no sens to call canReuse on it
- // In such case we continue in the isSame method because if we have null here, the previous value was null as well
- // If the previous value was not null and current is or vice verse, the deepEquals comparison would return false
+ // In such case we continue in the isSame method because if we have null here, the previous
+ // value was null as well
+ // If the previous value was not null and current is or vice verse, the deepEquals comparison
+ // would return false
"if(%1$s!= null) {\n" +
- "if (!dependencyResolver.canReuseDependency(%1$s, %1$sJmxAttribute)) { // reference to dependency must be reusable as well\n" +
+ "// reference to dependency must be reusable as well\n" +
+ "if (!dependencyResolver.canReuseDependency(%1$s, %1$sJmxAttribute)) {\n" +
"return false;\n" +
- "}\n" +
- "}\n", moduleField.getName());
+ "}\n" +
+ "}\n", moduleField.getName()));
}
}
- result += "\n"+
- "return true;\n"+
- "}\n";
+ result.append("\n" +
+ "return true;\n" +
+ "}\n");
- return result;
+ return result.toString();
}
private static String getResolveDependencies(final List<ModuleField> moduleFields) {
}
}
- String result = "\n"
- + "protected final void resolveDependencies() {\n";
+ StringBuilder result = new StringBuilder("\n" +
+ "protected final void resolveDependencies() {\n");
// wrap each field resolvation statement with if !=null when dependency is not mandatory
for (Map.Entry<ModuleField, String> entry : resolveDependenciesMap.entrySet()) {
- if (entry.getKey().getDependency().isMandatory() == false) {
+ if (!entry.getKey().getDependency().isMandatory()) {
checkState(entry.getValue().endsWith(";\n"));
- result += format("if (%s!=null) {\n%s}\n", entry.getKey().getName(), entry.getValue());
+ result.append(format("if (%s!=null) {\n%s}\n", entry.getKey().getName(), entry.getValue()));
} else {
- result += entry.getValue();
+ result.append(entry.getValue());
}
}
// add code to inject dependency resolver to fields that support it
for(ModuleField moduleField: moduleFields) {
if (moduleField.isNeedsDepResolver()) {
- result += format("if (%s!=null){\n", moduleField.getName());
+ result.append(format("if (%s!=null){\n", moduleField.getName()));
if (moduleField.isList()) {
- result += format(
- "for(%s candidate : %s) {\n"+
- "candidate.injectDependencyResolver(dependencyResolver);\n"+
- "}\n", moduleField.getGenericInnerType(), moduleField.getName());
+ result.append(format(
+ "for(%s candidate : %s) {\n" +
+ "candidate.injectDependencyResolver(dependencyResolver);\n" +
+ "}\n", moduleField.getGenericInnerType(), moduleField.getName()));
} else {
- result += format("%s.injectDependencyResolver(dependencyResolver);\n", moduleField.getName());
+ result.append(format("%s.injectDependencyResolver(dependencyResolver);\n", moduleField.getName()));
}
- result += "}\n";
+ result.append("}\n");
}
}
// identity refs need to be injected with dependencyResolver and base class
for (ModuleField moduleField : moduleFields) {
if (moduleField.isIdentityRef()) {
- result += format("if (%s!=null) {", moduleField.getName());
- result += format("set%s(%s.resolveIdentity(dependencyResolver, %s.class));",
+ result.append(format("if (%s!=null) {", moduleField.getName()));
+ result.append(format("set%s(%s.resolveIdentity(dependencyResolver, %s.class));",
moduleField.getAttributeName(), moduleField.getName(),
- ((IdentityRefModuleField)moduleField).getIdentityBaseClass());
- result += "}\n";
+ ((IdentityRefModuleField) moduleField).getIdentityBaseClass()));
+ result.append("}\n");
}
}
- result += "}\n";
- return result;
+ result.append("}\n");
+ return result.toString();
}
private static String getCachesOfResolvedIdentityRefs(List<ModuleField> moduleFields) {
}
private static String getValidationMethods(List<ModuleField> moduleFields) {
- String result = "\n"+
- "@Override\n"+
- "public void validate() {\n";
+ StringBuilder result = new StringBuilder("\n" +
+ "@Override\n" +
+ "public void validate() {\n");
// validate each mandatory dependency
- for(ModuleField moduleField: moduleFields) {
+ for (ModuleField moduleField : moduleFields) {
if (moduleField.isDependent()) {
if (moduleField.isList()) {
- result += "" +
- format("for(javax.management.ObjectName dep : %s) {\n", moduleField.getName()) +
- format(" dependencyResolver.validateDependency(%s.class, dep, %sJmxAttribute);\n",
- moduleField.getDependency().getSie().getFullyQualifiedName(), moduleField.getName()) +
- "}\n";
+ result.append(format("for(javax.management.ObjectName dep : %s) {\n", moduleField.getName()))
+ .append(format(" dependencyResolver.validateDependency(%s.class, dep, %sJmxAttribute);" +
+ "\n",
+ moduleField.getDependency().getSie().getFullyQualifiedName(),
+ moduleField.getName()))
+ .append("}\n");
} else {
- if(moduleField.getDependency().isMandatory() == false) {
- result += format("if(%s != null) {\n", moduleField.getName());
+ if (!moduleField.getDependency().isMandatory()) {
+ result.append(format("if(%s != null) {\n", moduleField.getName()));
}
- result += format("dependencyResolver.validateDependency(%s.class, %s, %sJmxAttribute);\n",
- moduleField.getDependency().getSie().getFullyQualifiedName(), moduleField.getName(), moduleField.getName());
- if(moduleField.getDependency().isMandatory() == false) {
- result += "}\n";
+ result.append(format("dependencyResolver.validateDependency(%s.class, %s, %sJmxAttribute);\n",
+ moduleField.getDependency().getSie().getFullyQualifiedName(), moduleField.getName(),
+ moduleField.getName()));
+ if (!moduleField.getDependency().isMandatory()) {
+ result.append("}\n");
}
}
}
}
- result += "\n"+
- "customValidation();\n"+
- "}\n"+
- "\n"+
- "protected void customValidation() {\n"+
- "}\n";
- return result;
+ result.append("\n" +
+ "customValidation();\n" +
+ "}\n" +
+ "\n" +
+ "protected void customValidation() {\n" +
+ "}\n");
+ return result.toString();
}
private static String getLoggerDefinition(FullyQualifiedName fqn) {
if (parent instanceof MethodDeclaration) {
// remember only top level description annotation
String reqVal = expr.getPairs().get(0).toString();
- requireIfc.put(((MethodDeclaration) parent).getName().toString(), reqVal);
+ requireIfc.put(((MethodDeclaration) parent).getName(), reqVal);
}
}
}
@Override
protected void checkMessage() {
final String message = OBJECT.getMessage();
- final String checkMessage = new StringBuilder("Actor ").append(ACTOR.toString())
- .append(" is not the current leader").toString();
+ final String checkMessage = "Actor " + ACTOR + " is not the current leader";
assertTrue(checkMessage.equals(message));
assertNull(OBJECT.getCause());
}
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("CaptureSnapshot [lastAppliedIndex=").append(lastAppliedIndex).append(", lastAppliedTerm=")
- .append(lastAppliedTerm).append(", lastIndex=").append(lastIndex).append(", lastTerm=")
- .append(lastTerm).append(", installSnapshotInitiated=")
- .append(", replicatedToAllIndex=").append(replicatedToAllIndex).append(", replicatedToAllTerm=")
- .append(replicatedToAllTerm).append(", unAppliedEntries size=")
- .append(unAppliedEntries.size()).append("]");
- return builder.toString();
+ return "CaptureSnapshot [lastAppliedIndex=" + lastAppliedIndex
+ + ", lastAppliedTerm=" + lastAppliedTerm
+ + ", lastIndex=" + lastIndex
+ + ", lastTerm=" + lastTerm
+ + ", installSnapshotInitiated="
+ + ", replicatedToAllIndex=" + replicatedToAllIndex
+ + ", replicatedToAllTerm=" + replicatedToAllTerm
+ + ", unAppliedEntries size=" + unAppliedEntries.size() + "]";
}
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("AppendEntries [leaderId=").append(leaderId).append(", prevLogIndex=").append(prevLogIndex)
- .append(", prevLogTerm=").append(prevLogTerm).append(", leaderCommit=").append(leaderCommit)
- .append(", replicatedToAllIndex=").append(replicatedToAllIndex).append(", payloadVersion=")
- .append(payloadVersion).append(", entries=").append(entries).append("]");
- return builder.toString();
+ return "AppendEntries [leaderId=" + leaderId
+ + ", prevLogIndex=" + prevLogIndex
+ + ", prevLogTerm=" + prevLogTerm
+ + ", leaderCommit=" + leaderCommit
+ + ", replicatedToAllIndex=" + replicatedToAllIndex
+ + ", payloadVersion=" + payloadVersion
+ + ", entries=" + entries + "]";
}
private Object writeReplace() {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("InstallSnapshotReply [term=").append(getTerm()).append(", followerId=").append(followerId)
- .append(", chunkIndex=").append(chunkIndex).append(", success=").append(success).append("]");
- return builder.toString();
+ return "InstallSnapshotReply [term=" + getTerm()
+ + ", followerId=" + followerId
+ + ", chunkIndex=" + chunkIndex
+ + ", success=" + success + "]";
}
private Object writeReplace() {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("RequestVote [term=").append(getTerm()).append(", candidateId=").append(candidateId)
- .append(", lastLogIndex=").append(lastLogIndex).append(", lastLogTerm=").append(lastLogTerm)
- .append("]");
- return builder.toString();
+ return "RequestVote [term=" + getTerm()
+ + ", candidateId=" + candidateId
+ + ", lastLogIndex=" + lastLogIndex
+ + ", lastLogTerm=" + lastLogTerm
+ + "]";
}
private Object writeReplace() {
}
if (message instanceof SetPeerAddress) {
- setPeerAddress(((SetPeerAddress) message).getPeerId().toString(),
+ setPeerAddress(((SetPeerAddress) message).getPeerId(),
((SetPeerAddress) message).getPeerAddress());
return;
}
return cachedMailBoxCapacity;
}
- final String PATH = new StringBuilder(TAG_MAILBOX).append(".").append(TAG_MAILBOX_CAPACITY).toString();
+ final String PATH = TAG_MAILBOX + "." + TAG_MAILBOX_CAPACITY;
cachedMailBoxCapacity = get().hasPath(PATH)
? get().getInt(PATH)
: DEFAULT_MAILBOX_CAPACITY;
return cachedMailBoxPushTimeout;
}
- final String PATH = new StringBuilder(TAG_MAILBOX).append(".").append(TAG_MAILBOX_PUSH_TIMEOUT).toString();
+ final String PATH = TAG_MAILBOX + "." + TAG_MAILBOX_PUSH_TIMEOUT;
long timeout = get().hasPath(PATH)
? get().getDuration(PATH, TimeUnit.NANOSECONDS)
}
private void init(final String actorName) {
- actorQualifiedName = new StringBuilder(meteredActor.getSelf().path().parent().toStringWithoutAddress())
- .append("/").append(actorName).toString();
+ actorQualifiedName = meteredActor.getSelf().path().parent().toStringWithoutAddress()
+ + "/" + actorName;
final String msgProcessingTime = MetricRegistry.name(actorQualifiedName, MSG_PROCESSING_RATE);
msgProcessingTimer = metricRegistry.timer(msgProcessingTime);
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("LeaderStateChanged [memberId=").append(memberId).append(", leaderId=").append(leaderId)
- .append(", leaderPayloadVersion=").append(leaderPayloadVersion).append("]");
- return builder.toString();
+ return "LeaderStateChanged [memberId=" + memberId
+ + ", leaderId=" + leaderId
+ + ", leaderPayloadVersion=" + leaderPayloadVersion + "]";
}
}
}
private static String largeString(final int pow) {
- String str = "X";
+ StringBuilder sb = new StringBuilder("X");
for (int i = 0; i < pow; i++) {
- StringBuilder buf = new StringBuilder();
- buf.append(str).append(str);
- str = buf.toString();
+ sb.append(sb);
}
- return str;
+ return sb.toString();
}
}
private static String largeString(int minSize) {
final int pow = (int) (Math.log(minSize * 2) / Math.log(2));
- String str = "X";
+ StringBuilder sb = new StringBuilder("X");
for (int i = 0; i < pow; i++) {
- StringBuilder buf = new StringBuilder();
- buf.append(str).append(str);
- str = buf.toString();
+ sb.append(sb);
}
- return str;
+ return sb.toString();
}
}
@Override
public String toString() {
- final StringBuilder sb = new StringBuilder("Entity{");
- sb.append("type='").append(type).append('\'');
- sb.append(", id=").append(id);
- sb.append('}');
- return sb.toString();
+ return "Entity{" + "type='" + type + '\'' + ", id=" + id + '}';
}
}
}
@Override public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("shardmanager-").append(type);
- return builder.toString();
+ return "shardmanager-" + type;
}
public static Builder builder() {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("BatchedModifications [transactionId=").append(transactionId).append(", ready=").append(ready)
- .append(", totalMessagesSent=").append(totalMessagesSent).append(", modifications size=")
- .append(getModifications().size()).append("]");
- return builder.toString();
+ return "BatchedModifications [transactionId=" + transactionId
+ + ", ready=" + ready
+ + ", totalMessagesSent=" + totalMessagesSent
+ + ", modifications size=" + getModifications().size() + "]";
}
}
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("BatchedModificationsReply [numBatched=").append(numBatched).append("]");
- return builder.toString();
+ return "BatchedModificationsReply [numBatched=" + numBatched + "]";
}
}
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("CreateTransactionReply [transactionPath=").append(transactionPath).append(", transactionId=")
- .append(transactionId).append(", version=").append(getVersion()).append("]");
- return builder.toString();
+ return "CreateTransactionReply [transactionPath=" + transactionPath
+ + ", transactionId=" + transactionId
+ + ", version=" + getVersion() + "]";
}
public static CreateTransactionReply fromSerializable(Object serializable) {
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append(getClass().getName()).append(" [shardName=").append(shardName).append(", waitUntilReady=")
- .append(waitUntilReady).append("]");
- return builder.toString();
+ return getClass().getName() + " [shardName=" + shardName
+ + ", waitUntilReady=" + waitUntilReady + "]";
}
}
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("LocalPrimaryShardFound [primaryPath=").append(primaryPath).append(", localShardDataTree=")
- .append(ObjectUtils.identityToString(localShardDataTree)).append("]");
- return builder.toString();
+ return "LocalPrimaryShardFound [primaryPath=" + primaryPath
+ + ", localShardDataTree=" + ObjectUtils.identityToString(localShardDataTree) + "]";
}
}
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append("RemotePrimaryShardFound [primaryPath=").append(primaryPath).append(", primaryVersion=")
- .append(primaryVersion).append("]");
- return builder.toString();
+ return "RemotePrimaryShardFound [primaryPath=" + primaryPath
+ + ", primaryVersion=" + primaryVersion + "]";
}
}
@Override
public String toString() {
- final StringBuilder sb = new StringBuilder("SwitchShardBehavior{");
- sb.append("shardId='").append(shardId).append('\'');
- sb.append(", newState='").append(newState).append('\'');
- sb.append(", term=").append(term);
- sb.append('}');
- return sb.toString();
+ return "SwitchShardBehavior{"
+ + "shardId='" + shardId + '\''
+ + ", newState='" + newState + '\''
+ + ", term=" + term
+ + '}';
}
}
Set<String> routedRpc = new HashSet<>(table.getRoutes().size());
for (DOMRpcIdentifier route : table.getRoutes()) {
if (!route.getContextReference().isEmpty()) {
- StringBuilder builder = new StringBuilder(ROUTE_CONSTANT);
- builder.append(route.getContextReference().toString()).append(NAME_CONSTANT).append(route.getType());
- routedRpc.add(builder.toString());
+ routedRpc.add(ROUTE_CONSTANT + route.getContextReference() + NAME_CONSTANT + route.getType());
}
}
if (!route.getContextReference().isEmpty()) {
String routeString = route.getContextReference().toString();
if (routeString.contains(routeName)) {
- StringBuilder builder = new StringBuilder(ROUTE_CONSTANT);
- builder.append(routeString).append(NAME_CONSTANT).append(route.getType());
- rpcMap.put(builder.toString(), address);
+ rpcMap.put(ROUTE_CONSTANT + routeString + NAME_CONSTANT + route.getType(), address);
}
}
}
if (!route.getContextReference().isEmpty()) {
String type = route.getType().toString();
if (type.contains(name)) {
- StringBuilder builder = new StringBuilder(ROUTE_CONSTANT);
- builder.append(route.getContextReference()).append(NAME_CONSTANT).append(type);
- rpcMap.put(builder.toString(), address);
+ rpcMap.put(ROUTE_CONSTANT + route.getContextReference() + NAME_CONSTANT + type, address);
}
}
}