com.google.common.base.Preconditions



API Populatity

83 Client projects

Project: com.google

Project Athou/commafeed in file ...ommafeed.frontend.rest.resources.SettingsREST.java (2013-03-24)
@@ -9,6 +9,7 @@ import javax.ws.rs.core.Response.Status;
 import com.commafeed.backend.model.UserSettings;
 import com.commafeed.backend.model.UserSettings.ReadingMode;
 import com.commafeed.frontend.model.Settings;
+import com.google.common.base.Preconditions;
 
 @Path("settings")
 public class SettingsREST extends AbstractREST {
@@ -29,6 +30,8 @@ public class SettingsREST extends AbstractREST {
 	@Path("save")
 	@POST
 	public Response save(Settings settings) {
+		Preconditions.checkNotNull(settings);
+		
 		UserSettings s = userSettingsService.findByUser(getUser());
 		if (s == null) {
 			s = new UserSettings();
Project MovingBlocks/Terasology in file ....terasology.reflection.metadata.ClassMetadata.java (2015-01-12)
@@ -16,6 +16,7 @@
 package org.terasology.reflection.metadata;
 
 import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Maps;
@@ -162,6 +163,7 @@ public boolean isConstructable() {
      * @return A new instance of this class.
      */
     public T newInstance() {
+        Preconditions.checkState(isConstructable(), "Cannot construct '" + this + "' - no accessible default constructor");
         return constructor.construct();
     }
 
Project MovingBlocks/Terasology in file ...g.terasology.rendering.primitives.Tessellator.java (2014-02-10)
@@ -15,6 +15,7 @@
  */
 package org.terasology.rendering.primitives;
 
+import com.google.common.base.Preconditions;
 import org.terasology.asset.AssetType;
 import org.terasology.asset.AssetUri;
 import org.terasology.asset.Assets;
@@ -170,6 +171,7 @@ public void setLighting(Vector3f v) {
     }
 
     public Mesh generateMesh(AssetUri uri) {
+        Preconditions.checkNotNull(uri);
         Mesh result = Assets.generateAsset(uri, meshData, Mesh.class);
         meshData = new MeshData();
         return result;