-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
96 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
core/src/main/java/io/github/mmm/marshall/AbstractStructuredScannerReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0 | ||
* http://www.apache.org/licenses/LICENSE-2.0 */ | ||
package io.github.mmm.marshall; | ||
|
||
import io.github.mmm.scanner.CharStreamScanner; | ||
|
||
/** | ||
* {@link AbstractStructuredReader} that {@link #readValue() reads values} as {@link Object}. | ||
*/ | ||
@SuppressWarnings("exports") | ||
public abstract class AbstractStructuredScannerReader extends AbstractStructuredValueReader { | ||
|
||
/** The {@link CharStreamScanner} to read from. */ | ||
protected final CharStreamScanner reader; | ||
|
||
/** | ||
* The constructor. | ||
* | ||
* @param scanner the {@link CharStreamScanner} to read from. | ||
* @param format the {@link #getFormat() format}. | ||
*/ | ||
public AbstractStructuredScannerReader(CharStreamScanner scanner, StructuredFormat format) { | ||
|
||
super(format); | ||
this.reader = scanner; | ||
} | ||
|
||
@Override | ||
protected String appendContextDetails(String message) { | ||
|
||
StringBuilder sb = new StringBuilder(message); | ||
sb.append('('); | ||
if (this.name != null) { | ||
sb.append("at property '"); | ||
sb.append(this.name); | ||
sb.append("' "); | ||
} | ||
sb.append("in line "); | ||
sb.append(this.reader.getLine()); | ||
sb.append(" and column "); | ||
sb.append(this.reader.getColumn()); | ||
sb.append(')'); | ||
return sb.toString(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
|
||
this.reader.close(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters