Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/mdo/java/InputLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public InputSource getSource() {

@Override
public InputLocation getLocation(Object key) {
Objects.requireNonNull(key, "key");
return locations != null ? locations.get(key) : null;
}

Expand Down
16 changes: 16 additions & 0 deletions src/mdo/java/InputLocationTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,23 @@
*/
package ${package};

/**
* Tracks input source locations for model fields.
* <p>
* Implementations provide a mapping from keys (typically field names or indices) to
* {@link InputLocation} instances to support precise error reporting and diagnostics.
* Keys must be non-null.
*
* @since 4.0.0
*/
public interface InputLocationTracker {
/**
* Gets the location of the specified field in the input source.
*
* @param field the key of the field, must not be {@code null}
* @return the location of the field in the input source or {@code null} if unknown
* @throws NullPointerException if {@code field} is {@code null}
*/
InputLocation getLocation(Object field);

/**
Expand Down
5 changes: 5 additions & 0 deletions src/mdo/model.vm
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,13 @@ public class ${class.name}
#if ( $locationTracking && !$class.superClass )
/**
* Gets the location of the specified field in the input source.
*
* @param key the key of the field, must not be {@code null}
* @return the location of the field in the input source or {@code null} if unknown
* @throws NullPointerException if {@code key} is {@code null}
*/
public InputLocation getLocation(Object key) {
Objects.requireNonNull(key, "key");
return locations.get(key);
}

Expand Down
Loading