@Test public void testParse() { ResourceReference expected = new ResourceReference("reference", ResourceType.DOCUMENT); expected.setParameter("param1", "value1"); expected.setParameter("param2", "value2"); Assert.assertEquals(expected, this.parser.parse("true|-|doc|-|reference|-|param1=value1 param2=value2")); }
@Override public ResourceReference parse(String rawReference) { String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(rawReference, COMMENT_SEPARATOR); boolean isTyped = "true".equalsIgnoreCase(tokens[0]); ResourceType type = new ResourceType(tokens[1]); String reference = tokens[2]; ResourceReference resourceReference = new ResourceReference(reference, type); resourceReference.setTyped(isTyped); if (tokens.length == 4) { for (WikiParameter parameter : WikiParameters.newWikiParameters(tokens[3])) { resourceReference.setParameter(parameter.getKey(), parameter.getValue()); } } return resourceReference; }
XHTMLMarkerResourceReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(rawReference, COMMENT_SEPARATOR); boolean isTyped = "true".equalsIgnoreCase(tokens[0]); ResourceType type = new ResourceType(tokens[1]); String reference = tokens[2]; ResourceReference resourceReference = new ResourceReference(reference, type); resourceReference.setTyped(isTyped); if (tokens.length == 4) { for (WikiParameter parameter : WikiParameters.newWikiParameters(tokens[3])) { resourceReference.setParameter(parameter.getKey(), parameter.getValue()); } } return resourceReference; } }
XHTMLMarkerResourceReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(rawReference, COMMENT_SEPARATOR); boolean isTyped = "true".equalsIgnoreCase(tokens[0]); ResourceType type = new ResourceType(tokens[1]); String reference = tokens[2]; ResourceReference resourceReference = new ResourceReference(reference, type); resourceReference.setTyped(isTyped); if (tokens.length == 4) { for (WikiParameter parameter : WikiParameters.newWikiParameters(tokens[3])) { resourceReference.setParameter(parameter.getKey(), parameter.getValue()); } } return resourceReference; }  }
XHTMLMarkerResourceReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(rawReference, COMMENT_SEPARATOR); boolean isTyped = "true".equalsIgnoreCase(tokens[0]); ResourceType type = new ResourceType(tokens[1]); String reference = tokens[2]; ResourceReference resourceReference = new ResourceReference(reference, type); resourceReference.setTyped(isTyped); if (tokens.length == 4) { for (WikiParameter parameter : WikiParameters.newWikiParameters(tokens[3])) { resourceReference.setParameter(parameter.getKey(), parameter.getValue()); } } return resourceReference; }  @Override ResourceReference parse(String rawReference); }
XHTMLMarkerResourceReferenceParser implements ResourceReferenceParser { @Override public ResourceReference parse(String rawReference) { String[] tokens = StringUtils.splitByWholeSeparatorPreserveAllTokens(rawReference, COMMENT_SEPARATOR); boolean isTyped = "true".equalsIgnoreCase(tokens[0]); ResourceType type = new ResourceType(tokens[1]); String reference = tokens[2]; ResourceReference resourceReference = new ResourceReference(reference, type); resourceReference.setTyped(isTyped); if (tokens.length == 4) { for (WikiParameter parameter : WikiParameters.newWikiParameters(tokens[3])) { resourceReference.setParameter(parameter.getKey(), parameter.getValue()); } } return resourceReference; }  @Override ResourceReference parse(String rawReference);  }