Skip to content

Commit

Permalink
Reformat source to new Maven style
Browse files Browse the repository at this point in the history
  • Loading branch information
mosabua committed Oct 22, 2024
1 parent 59391d3 commit 3232324
Show file tree
Hide file tree
Showing 15 changed files with 952 additions and 1,246 deletions.
Original file line number Diff line number Diff line change
@@ -1,80 +1,67 @@
/**
/**
* Copyright simpligility technologies inc. http://www.simpligility.com
* Licensed under Eclipse Public License - v 1.0 http://www.eclipse.org/legal/epl-v10.html
*/
package com.simpligility.maven;

public final class Gav
{
public final class Gav {
private final String groupId;

private final String artifactId;

private final String version;

private final String packaging;

public Gav( String groupId, String artifactId, String version, String packaging )
{
public Gav(String groupId, String artifactId, String version, String packaging) {
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.packaging = packaging;
}

public String getGroupId()
{
public String getGroupId() {
return groupId;
}

public String getArtifactId()
{
public String getArtifactId() {
return artifactId;
}

public String getVersion()
{
public String getVersion() {
return version;
}

public String getPackaging()
{
public String getPackaging() {
return packaging;
}

public String getPomFilename()
{
public String getPomFilename() {
return getFilenameStart() + "." + MavenConstants.POM;
}

public String getJarFilename()
{
public String getJarFilename() {
return getFilenameStart() + "." + MavenConstants.JAR;
}

public String getFilenameStart()
{
public String getFilenameStart() {
return artifactId + "-" + version;
}

public String getSourceFilename()
{
public String getSourceFilename() {
return getFilenameStart() + MavenConstants.SOURCES_JAR;
}

public String getJavadocFilename()
{
public String getJavadocFilename() {
return getFilenameStart() + MavenConstants.JAVADOC_JAR;
}

public String getRepositoryURLPath()
{
return groupId.replace( ".", "/" ) + "/" + artifactId + "/" + version + "/";

public String getRepositoryURLPath() {
return groupId.replace(".", "/") + "/" + artifactId + "/" + version + "/";
}

@Override
public String toString()
{
public String toString() {
return groupId + ":" + artifactId + ":" + version;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
/**
/**
* Copyright simpligility technologies inc. http://www.simpligility.com
* Licensed under Eclipse Public License - v 1.0 http://www.eclipse.org/legal/epl-v10.html
*/
package com.simpligility.maven;

import java.io.File;

public class GavUtil
{
public class GavUtil {

public static Gav getGavFromRepositoryPath( String leafRepoPath )
{
public static Gav getGavFromRepositoryPath(String leafRepoPath) {

int versionStartSlash = leafRepoPath.lastIndexOf( File.separator );
String version = leafRepoPath.substring( versionStartSlash + 1, leafRepoPath.length() );
int versionStartSlash = leafRepoPath.lastIndexOf(File.separator);
String version = leafRepoPath.substring(versionStartSlash + 1, leafRepoPath.length());

String gaPath = leafRepoPath.substring( 0, versionStartSlash );
int gaStartSlash = gaPath.lastIndexOf( File.separator );
String artifactId = gaPath.substring( gaStartSlash + 1, gaPath.length() );
String gaPath = leafRepoPath.substring(0, versionStartSlash);
int gaStartSlash = gaPath.lastIndexOf(File.separator);
String artifactId = gaPath.substring(gaStartSlash + 1, gaPath.length());

String gPath = gaPath.substring( 0, gaStartSlash );
String groupId = gPath.replace( File.separator, "." );
String gPath = gaPath.substring(0, gaStartSlash);
String groupId = gPath.replace(File.separator, ".");

return new Gav( groupId, artifactId, version, null );
return new Gav(groupId, artifactId, version, null);
}


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.simpligility.maven;

public final class MavenConstants
{
public final class MavenConstants {
public static final String JAVADOC = "javadoc";
public static final String SOURCES = "sources";
public static final String POM = "pom";
Expand All @@ -24,43 +23,33 @@ public final class MavenConstants
* @param packaging
* @return
*/
public static boolean packagingUsesJarOnly( String packaging )
{
boolean result = false;
if ( JAR.equals( packaging )
|| BUNDLE.equals( packaging )
|| MAVEN_PLUGIN.equals( packaging ) )
{
result = true;
}
return result;
public static boolean packagingUsesJarOnly(String packaging) {
boolean result = false;
if (JAR.equals(packaging) || BUNDLE.equals(packaging) || MAVEN_PLUGIN.equals(packaging)) {
result = true;
}
return result;
}

/**
* Return if a specific packaging uses jar file as additional artifacts.
* @param packaging
* @return
*/
public static boolean packagingUsesAdditionalJar( String packaging )
{
boolean result = false;
if ( HPI.equals( packaging )
|| JPI.equals( packaging )
|| AAR.equals( packaging )
|| ZIP.equals( packaging ) )
{
result = true;
}
return result;
public static boolean packagingUsesAdditionalJar(String packaging) {
boolean result = false;
if (HPI.equals(packaging) || JPI.equals(packaging) || AAR.equals(packaging) || ZIP.equals(packaging)) {
result = true;
}
return result;
}

/**
* Return if a specific packaging uses jar artifacts (main or additional)
* @param packaging
* @return
*/
public static boolean packagingUsesJar( String packaging )
{
return ( packagingUsesJarOnly( packaging ) || packagingUsesAdditionalJar( packaging ) );
public static boolean packagingUsesJar(String packaging) {
return (packagingUsesJarOnly(packaging) || packagingUsesAdditionalJar(packaging));
}
}
Loading

0 comments on commit 3232324

Please sign in to comment.