Skip to content

Commit

Permalink
feat(java-info): Refactor the java-info module base on the format pro…
Browse files Browse the repository at this point in the history
…tocol files (#595)
  • Loading branch information
Thespica authored Sep 19, 2024
1 parent c260513 commit e265e0e
Show file tree
Hide file tree
Showing 23 changed files with 973 additions and 673 deletions.
6 changes: 6 additions & 0 deletions maven-projects/info/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<proto-info.version>0.13.0.dev-SNAPSHOT</proto-info.version>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.graphar</groupId>
<artifactId>proto</artifactId>
<version>${proto-info.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,42 @@

package org.apache.graphar.info;

import org.apache.graphar.info.type.AdjListType;
import org.apache.graphar.info.type.FileType;
import org.apache.graphar.info.yaml.AdjacentListYaml;
import org.apache.graphar.proto.AdjListType;
import org.apache.graphar.proto.FileType;

public class AdjacentList {
private final AdjListType type;
private final FileType fileType;
private final String prefix;
private final org.apache.graphar.proto.AdjacentList protoAdjacentList;

public AdjacentList(AdjListType type, FileType fileType, String prefix) {
this.type = type;
this.fileType = fileType;
this.prefix = prefix;
protoAdjacentList =
org.apache.graphar.proto.AdjacentList.newBuilder()
.setType(type)
.setFileType(fileType)
.setPrefix(prefix)
.build();
}

AdjacentList(AdjacentListYaml yamlParser) {
this.type =
AdjListType.fromOrderedAndAlignedBy(
yamlParser.isOrdered(), yamlParser.isAligned_by());
this.fileType = FileType.valueOf(yamlParser.getFile_type());
this.prefix = yamlParser.getPrefix();
private AdjacentList(org.apache.graphar.proto.AdjacentList protoAdjacentList) {
this.protoAdjacentList = protoAdjacentList;
}

public static AdjacentList ofProto(org.apache.graphar.proto.AdjacentList protoAdjacentList) {
return new AdjacentList(protoAdjacentList);
}

public AdjListType getType() {
return type;
return protoAdjacentList.getType();
}

public FileType getFileType() {
return fileType;
return protoAdjacentList.getFileType();
}

public String getPrefix() {
return prefix;
return protoAdjacentList.getPrefix();
}

org.apache.graphar.proto.AdjacentList getProto() {
return protoAdjacentList;
}
}
Loading

0 comments on commit e265e0e

Please sign in to comment.