org.robolectric.res.ResBunch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resources Show documentation
Show all versions of resources Show documentation
An alternative Android testing framework.
package org.robolectric.res;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import org.robolectric.res.android.ResTable_config;
public class ResBunch {
private final Map types = new LinkedHashMap<>();
public void put(ResName resName, TypedResource value) {
ResBundle bundle = getBundle(resName.type);
bundle.put(resName, value);
}
private ResBundle getBundle(String attrType) {
ResBundle bundle = types.get(attrType);
if (bundle == null) {
bundle = new ResBundle();
types.put(attrType, bundle);
}
return bundle;
}
public TypedResource get(@Nonnull ResName resName, ResTable_config config) {
ResBundle bundle = getBundle(resName.type);
return bundle.get(resName, config);
}
void receive(ResourceTable.Visitor visitor) {
for (ResBundle resBundle : types.values()) {
resBundle.receive(visitor);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy