2626public final class Pickle {
2727 private final String id ;
2828 private final String uri ;
29+ private final Location location ;
2930 private final String name ;
3031 private final String language ;
3132 private final java .util .List <PickleStep > steps ;
@@ -35,6 +36,7 @@ public final class Pickle {
3536 public Pickle (
3637 String id ,
3738 String uri ,
39+ Location location ,
3840 String name ,
3941 String language ,
4042 java .util .List <PickleStep > steps ,
@@ -43,6 +45,7 @@ public Pickle(
4345 ) {
4446 this .id = requireNonNull (id , "Pickle.id cannot be null" );
4547 this .uri = requireNonNull (uri , "Pickle.uri cannot be null" );
48+ this .location = location ;
4649 this .name = requireNonNull (name , "Pickle.name cannot be null" );
4750 this .language = requireNonNull (language , "Pickle.language cannot be null" );
4851 this .steps = unmodifiableList (new ArrayList <>(requireNonNull (steps , "Pickle.steps cannot be null" )));
@@ -64,6 +67,13 @@ public String getUri() {
6467 return uri ;
6568 }
6669
70+ /**
71+ * The location of this pickle in source file. A pickle constructed from `Examples` will point to the example row.
72+ */
73+ public Optional <Location > getLocation () {
74+ return Optional .ofNullable (location );
75+ }
76+
6777 /**
6878 * The name of the pickle
6979 */
@@ -110,6 +120,7 @@ public boolean equals(Object o) {
110120 return
111121 id .equals (that .id ) &&
112122 uri .equals (that .uri ) &&
123+ Objects .equals (location , that .location ) &&
113124 name .equals (that .name ) &&
114125 language .equals (that .language ) &&
115126 steps .equals (that .steps ) &&
@@ -122,6 +133,7 @@ public int hashCode() {
122133 return Objects .hash (
123134 id ,
124135 uri ,
136+ location ,
125137 name ,
126138 language ,
127139 steps ,
@@ -135,6 +147,7 @@ public String toString() {
135147 return "Pickle{" +
136148 "id=" + id +
137149 ", uri=" + uri +
150+ ", location=" + location +
138151 ", name=" + name +
139152 ", language=" + language +
140153 ", steps=" + steps +
0 commit comments