@Test public void parse_invalid_string() { exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage("Invalid TextRange '12345'"); RangeConverter.parse("12345"); }
@Nullable public static TextRange parse(@Nullable String value) { if (value == null) { return null; } String[] values = value.split(":", 4); if (values.length != 4) { throw new IllegalArgumentException("Invalid TextRange '" + value + "'"); } int startLine = Integer.parseInt(values[0]); int startLineOffset = Integer.parseInt(values[1]); int endLine = Integer.parseInt(values[2]); int endLineOffset = Integer.parseInt(values[3]); return new TextRangeImpl(startLine, startLineOffset, endLine, endLineOffset); }
RangeConverter { @Nullable public static TextRange parse(@Nullable String value) { if (value == null) { return null; } String[] values = value.split(":", 4); if (values.length != 4) { throw new IllegalArgumentException("Invalid TextRange '" + value + "'"); } int startLine = Integer.parseInt(values[0]); int startLineOffset = Integer.parseInt(values[1]); int endLine = Integer.parseInt(values[2]); int endLineOffset = Integer.parseInt(values[3]); return new TextRangeImpl(startLine, startLineOffset, endLine, endLineOffset); } }
RangeConverter { @Nullable public static TextRange parse(@Nullable String value) { if (value == null) { return null; } String[] values = value.split(":", 4); if (values.length != 4) { throw new IllegalArgumentException("Invalid TextRange '" + value + "'"); } int startLine = Integer.parseInt(values[0]); int startLineOffset = Integer.parseInt(values[1]); int endLine = Integer.parseInt(values[2]); int endLineOffset = Integer.parseInt(values[3]); return new TextRangeImpl(startLine, startLineOffset, endLine, endLineOffset); } private  RangeConverter(); }
RangeConverter { @Nullable public static TextRange parse(@Nullable String value) { if (value == null) { return null; } String[] values = value.split(":", 4); if (values.length != 4) { throw new IllegalArgumentException("Invalid TextRange '" + value + "'"); } int startLine = Integer.parseInt(values[0]); int startLineOffset = Integer.parseInt(values[1]); int endLine = Integer.parseInt(values[2]); int endLineOffset = Integer.parseInt(values[3]); return new TextRangeImpl(startLine, startLineOffset, endLine, endLineOffset); } private  RangeConverter(); @Nullable static String format(@Nullable TextRange range); @Nullable static TextRange parse(@Nullable String value); @Nullable static String tokenReference(@Nullable Token token); @Nullable static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference); static String metaDataReference(Tree tree); static TreeMetaData resolveMetaData(TreeMetaDataProvider metaDataProvider, String metaDataReference); @Nullable static String treeReference(@Nullable Tree tree); @Nullable static T resolveNullableTree(Tree parent, @Nullable String treeReference, Class<T> childClass); }
RangeConverter { @Nullable public static TextRange parse(@Nullable String value) { if (value == null) { return null; } String[] values = value.split(":", 4); if (values.length != 4) { throw new IllegalArgumentException("Invalid TextRange '" + value + "'"); } int startLine = Integer.parseInt(values[0]); int startLineOffset = Integer.parseInt(values[1]); int endLine = Integer.parseInt(values[2]); int endLineOffset = Integer.parseInt(values[3]); return new TextRangeImpl(startLine, startLineOffset, endLine, endLineOffset); } private  RangeConverter(); @Nullable static String format(@Nullable TextRange range); @Nullable static TextRange parse(@Nullable String value); @Nullable static String tokenReference(@Nullable Token token); @Nullable static Token resolveToken(TreeMetaDataProvider metaDataProvider, @Nullable String tokenReference); static String metaDataReference(Tree tree); static TreeMetaData resolveMetaData(TreeMetaDataProvider metaDataProvider, String metaDataReference); @Nullable static String treeReference(@Nullable Tree tree); @Nullable static T resolveNullableTree(Tree parent, @Nullable String treeReference, Class<T> childClass);  }