JSON assets) throws Exception {
List<AssetMetaData> abc = Collections.emptyList();
if (assets != null && assets.getSize() > 0) {
abc = new ArrayList<AssetMetaData>();
for (String id : assets.names()) {
JSON asset = assets.getJSON(id);
AssetLocation location = AssetLocation.safeValueOf(asset.getString("location"));
//
if (location == null) {
location = AssetLocation.APPLICATION;
}
//
String type = asset.getString("type");
//
String value = asset.getString("value");
if (location == AssetLocation.APPLICATION && !value.startsWith("/")) {
value = "/" + application.getPackageName().replace('.', '/') + "/" + packageName.replace('.', '/') + "/" + value;
}
String minified = asset.getString("minified");
if (location == AssetLocation.APPLICATION && minified != null && !minified.startsWith("/")) {
minified = "/" + application.getPackageName().replace('.', '/') + "/" + packageName.replace('.', '/') + "/" + minified;
}
Boolean header = asset.getBoolean("header");
//
Integer maxAge = asset.getInteger("max-age");
//
AssetMetaData descriptor = new AssetMetaData(
id,
type,
location,
value,
header,
minified,
maxAge,
asset.getArray("depends", String.class)
);
abc.add(descriptor);
}
}
return abc;