1 package com.xtremelabs.robolectric.res; 2 3 import org.w3c.dom.Node; 4 5 public class StringResourceLoader extends XpathResourceXmlLoader implements ResourceValueConverter { 6 private ResourceReferenceResolver<String> stringResolver = new ResourceReferenceResolver<String>("string"); 7 8 public StringResourceLoader(ResourceExtractor resourceExtractor) { 9 super(resourceExtractor, "/resources/string"); 10 } 11 12 public String getValue(int resourceId) { 13 return stringResolver.getValue(resourceExtractor.getResourceName(resourceId)); 14 } 15 16 public String getValue(String resourceName, boolean isSystem) { 17 return getValue(resourceExtractor.getResourceId(resourceName, isSystem)); 18 } 19 20 @Override protected void processNode(Node node, String name, boolean isSystem) { 21 stringResolver.processResource(name, node.getTextContent(), this, isSystem); 22 } 23 24 @Override public Object convertRawValue(String rawValue) { 25 return rawValue; 26 } 27 } 28