use of com.android.builder.model.ClassField in project android by JetBrains.
the class StringResourceDataTest method setUpData.
private void setUpData() {
Collection<VirtualFile> resourceDirectories = Collections.singletonList(resourceDirectory);
ClassField field = Mockito.mock(ClassField.class);
Mockito.when(field.getType()).thenReturn("string");
Mockito.when(field.getName()).thenReturn("dynamic_key1");
Mockito.when(field.getValue()).thenReturn("L\\'Étranger");
Map<String, ClassField> values = Collections.singletonMap("dynamic_key1", field);
LocalResourceRepository otherDelegate = DynamicResourceValueRepository.createForTest(myFacet, values);
Disposer.register(myFacet, otherDelegate);
Collection<LocalResourceRepository> otherDelegates = Collections.singletonList(otherDelegate);
data = StringResourceParser.parse(myFacet, ModuleResourceRepository.createForTest(myFacet, resourceDirectories, otherDelegates));
}
use of com.android.builder.model.ClassField in project android by JetBrains.
the class DynamicResourceValueRepository method addValues.
private void addValues(Map<String, ClassField> resValues) {
for (Map.Entry<String, ClassField> entry : resValues.entrySet()) {
ClassField field = entry.getValue();
String name = field.getName();
assert entry.getKey().equals(name) : entry.getKey() + " vs " + name;
ResourceType type = ResourceType.getEnum(field.getType());
if (type == null) {
LOG.warn("Ignoring field " + name + "(" + field + "): unknown type " + field.getType());
continue;
}
ListMultimap<String, ResourceItem> map = mItems.get(type);
if (map == null) {
map = ArrayListMultimap.create();
mItems.put(type, map);
} else if (map.containsKey(name)) {
// Masked by higher priority source provider
continue;
}
ResourceItem item = new DynamicResourceValueItem(type, field);
map.put(name, item);
}
}
Aggregations