Ejemplo n.º 1
0
 @Override
 public T deserialize(EntityData.Value value) {
   if (value.getStringCount() > 0) {
     Asset asset = Assets.resolve(type, value.getString(0));
     if (asset != null && assetClass.isAssignableFrom(asset.getClass())) {
       return assetClass.cast(asset);
     }
   }
   return null;
 }
Ejemplo n.º 2
0
 @Override
 public List<T> deserializeCollection(EntityData.Value value) {
   List<T> result = Lists.newArrayListWithCapacity(value.getStringCount());
   for (String item : value.getStringList()) {
     Asset asset = Assets.resolve(type, item);
     if (asset != null && assetClass.isAssignableFrom(asset.getClass())) {
       result.add(assetClass.cast(asset));
     }
   }
   return result;
 }