Skip to content

Commit

Permalink
调整请求和反馈数据clone处理
Browse files Browse the repository at this point in the history
处理反馈内容错误bug修复
  • Loading branch information
Sheedon committed Sep 2, 2020
1 parent a873ee4 commit adb5197
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
8 changes: 3 additions & 5 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions seriallibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 7
versionName "1.2.2"
versionCode 8
versionName "1.2.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ String getBackName() {
void setBackName(String backName) {
this.backName = backName;
}


public BindCallback clone() {
try {
return (BindCallback) super.clone();
} catch (CloneNotSupportedException e) {
BindCallback bindCallback = new BindCallback();
bindCallback.delayMilliSecond = delayMilliSecond;
bindCallback.backName = backName;
return bindCallback;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void apply(RequestBuilder builder, @Nullable T value) {
throw new IllegalArgumentException(
"Path parameter \"" + name + "\" value must not be null.");
}
builder.addPathParam(name, valueConverter.convert(value), encoded);
builder.addBackPathParam(name, valueConverter.convert(value), encoded);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ public void setEndBit(String endBit) {
this.endBit = endBit;
}

public SerialMessage clone(){
SerialMessage message = new SerialMessage();
message.startBit = startBit;
message.messageBit = messageBit;
message.parityBit = parityBit;
message.endBit = endBit;
return message;

@Override
public SerialMessage clone() {
try {
return (SerialMessage) super.clone();
} catch (CloneNotSupportedException e) {
SerialMessage message = new SerialMessage();
message.startBit = startBit;
message.messageBit = messageBit;
message.parityBit = parityBit;
message.endBit = endBit;
return message;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final class ServiceMethod<R, T> {
Request toRequest(@Nullable Object... args) throws IOException {

RequestBuilder requestBuilder = new RequestBuilder(this, serialMessage.clone(),
bindCallback);
bindCallback.clone());

@SuppressWarnings("unchecked") // It is an error to invoke a method with the wrong arg types.
ParameterHandler<Object>[] handlers = (ParameterHandler<Object>[]) parameterHandlers;
Expand Down Expand Up @@ -345,7 +345,7 @@ private ParameterHandler<?> parseParameterAnnotation(
BackPath path = (BackPath) annotation;
String name = path.value();
Converter<?, String> converter = retrofit.stringConverter(type, annotations);
return new ParameterHandler.Path<>(name, converter, path.encoded());
return new ParameterHandler.BackPath<>(name, converter, path.encoded());
}
return null; // Not a Retrofit annotation.
}
Expand Down

0 comments on commit adb5197

Please sign in to comment.