Skip to content

Conversation

@olamothe
Copy link
Member

Repetition of what was done for previous clients in other languages.

https://coveord.atlassian.net/browse/CDX-386

@olamothe olamothe merged commit 7b4785c into main Jun 28, 2021
Copy link
Contributor

@louis-bompart louis-bompart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could use final in a lot of places to make your code more performant (although marginally I reckon.).

import java.util.Map;

public class AliasMapping extends IdentityModel {
public String provider;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After initializing the variable, you never change the value. You should therefore transcribe that behaviour semantically with the final keyword. It can help the JVM and thus increase the performance.

Suggested change
public String provider;
public final String provider;

Comment on lines +6 to +8
public Map<String, String> additionalInfo;
public String name;
public SecurityIdentityType type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After initializing those variables, you never change their values. You should therefore transcribe that behaviour semantically with the final keyword. It can help the JVM and thus increase the performance.

Suggested change
public Map<String, String> additionalInfo;
public String name;
public SecurityIdentityType type;
public final Map<String, String> additionalInfo;
public final String name;
public final SecurityIdentityType type;

package com.coveo.pushapiclient;

public class SecurityIdentityAliasModel extends SecurityIdentityModelBase {
public AliasMapping[] mappings;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After initializing the variable, you never change its values. You should therefore transcribe that behaviour semantically with the final keyword. It can help the JVM and thus increase the performance.

Suggested change
public AliasMapping[] mappings;
public final AliasMapping[] mappings;

Comment on lines +4 to +5
public String fileId;
public Long orderingId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After initializing those variables, you never change their values. You should therefore transcribe that behaviour semantically with the final keyword. It can help the JVM and thus increase the performance.

Suggested change
public String fileId;
public Long orderingId;
public final String fileId;
public final Long orderingId;

Comment on lines +1 to +9
package com.coveo.pushapiclient;

public class SecurityIdentityDelete {
public IdentityModel identity;

public SecurityIdentityDelete(IdentityModel identity) {
this.identity = identity;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the goal of this class?
It doesn't seem to me to do anything meaningful

Copy link
Member Author

@olamothe olamothe Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a data class. It is ultimately just serialized in JSON.

Used for source.deleteSecurityIdentity

Comment on lines +4 to +5
public Integer queueDelay;
public Long orderingId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After initializing those variables, you never change their values. You should therefore transcribe that behaviour semantically with the final keyword. It can help the JVM and thus increase the performance.

Suggested change
public Integer queueDelay;
public Long orderingId;
public final Integer queueDelay;
public final Long orderingId;

package com.coveo.pushapiclient;

public class SecurityIdentityModel extends SecurityIdentityModelBase {
public IdentityModel[] members;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After initializing the variable, you never change itsvalue. You should therefore transcribe that behaviour semantically with the final keyword. It can help the JVM and thus increase the performance.

Suggested change
public IdentityModel[] members;
public final IdentityModel[] members;

Comment on lines +4 to +5
public IdentityModel identity;
public IdentityModel[] wellKnowns;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After initializing those variables, you never change their values. You should therefore transcribe that behaviour semantically with the final keyword. It can help the JVM and thus increase the performance.

Suggested change
public IdentityModel identity;
public IdentityModel[] wellKnowns;
public final IdentityModel identity;
public final IdentityModel[] wellKnowns;

@y-lakhdar y-lakhdar deleted the CDX-386 branch June 15, 2023 18:21
This was referenced Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants