Skip to content

Instantly share code, notes, and snippets.

View GuiSim's full-sized avatar
🐼

Guillaume Simard GuiSim

🐼
  • Tola
  • Québec
View GitHub Profile
List<String> rows = Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8);
String header = rows.remove(0);
// You can then continue with your application logic
int headerColumnCount = header.split(Constants.SEPERATOR_ESCAPED).length;
for (String row : rows) {
System.out.println(row);
}

Keybase proof

I hereby claim:

  • I am guisim on github.
  • I am guisim (https://keybase.io/guisim) on keybase.
  • I have a public key whose fingerprint is DD4C B4C6 9502 C419 FAD2 E477 B9D0 A623 7AF2 4BEB

To claim this, I am signing this object:

public class MyServiceClient {
@Inject
public MyServiceClient(@Named("service.endpoint") Prop<String> endpoint,
@Named("service.readTimeout") Prop<Duration> readTimeout,
HttpClient httpClient) {
this.endpoint = endpoint;
this.readTimeout = readTimeout;
this.httpClient = httpClient;
}
List<Module> modules = ... // Get your Guice modules
AutoPropModule autoPropModule = new AutoPropModule("io.pleo", // Package prefix
modules, // Modules to scan
new ArchaiusPropFactory(),
new JacksonParserFactory());
modules.add(autoPropModule);
Injector injector = Guice.createInjector(modules);
public static class MyServiceClass {
private AwsClient awsClient;
public MyServiceClass(@Named("aws.key") Prop<String> awsKey)
{
this.awsClient = new AwsClient(awsKey.get());
}
}
public static class MyServiceClass {
private AwsClient awsClient;
public MyServiceClass(@Named("aws.key") Prop<String> awsKey) {
this.awsClient = new AwsClient(awsKey.get());
awsKey.addCallback(() -> this.awsClient = new AwsClient(awsKey.get()));
}
}
// Property with no value
Property 'service.endpoint' has a no value.
// Property with no @Named annotation
Property identified by key 'Key[type=io.pleo.prop.core.Prop<java.lang.String>, annotation=[none]]' has no @Named annotation.
// When a valid value was changed to an invalid one
Failed to parse property 'service.readTimeout' with value 'potato'. Keeping last valid value of 'PT1S'.
...
<name>${project.groupId}:${project.artifactId}</name>
<description>Your artifact description</description>
<url>Link to your page or GitHub</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
...
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
...
<servers>
...
<server>
<id>ossrh</id>
<username>YOUR_OSSRH_JIRA_USER</username>
<password>YOUR_OSSRH_JIRA_PASSWORD</password>
</server>
...
<profiles>