List of usage examples for com.google.common.base Preconditions checkNotNull
public static <T> T checkNotNull(T reference)
From source file:com.github.mike10004.jenkinsbbhook.ContextAppParams.java
public ContextAppParams(Function<String, String> paramValueProvider) { this.paramValueProvider = Preconditions.checkNotNull(paramValueProvider); }
From source file:com.google.ipc.invalidation.ticl.ProtoConverter.java
/** * Converts an object id protocol buffer {@code objectId} to the * corresponding external type and returns it. *///from w w w . j av a 2s. c o m public static ObjectId convertFromObjectIdProto(ObjectIdP objectIdProto) { Preconditions.checkNotNull(objectIdProto); return ObjectId.newInstance(objectIdProto.getSource(), objectIdProto.getName().toByteArray()); }
From source file:cz.cuni.mff.ms.brodecva.botnicek.ide.check.simplepattern.model.builder.DefaultSimplePatternBuilderFactory.java
/** * Vytvo tovrnu.//from ww w.j a v a2 s . c om * * @param checker * validtor * @return tovrna */ public static DefaultSimplePatternBuilderFactory create(final Checker checker) { Preconditions.checkNotNull(checker); return new DefaultSimplePatternBuilderFactory(checker); }
From source file:tiger.NewBindingKey.java
public static NewBindingKey get(TypeMirror type, @Nullable AnnotationMirror qualifier) { Preconditions.checkNotNull(type); TypeKind typeKind = type.getKind(); if (typeKind.equals(TypeKind.ERROR)) { throw new ResolveTypeMirrorException(type); }/*from w ww . java 2 s. c om*/ Preconditions.checkArgument( typeKind.equals(TypeKind.DECLARED) || typeKind.isPrimitive() || typeKind.equals(TypeKind.TYPEVAR) || typeKind.equals(TypeKind.ARRAY), String.format("Unexpected type %s of Kind %s", type, typeKind)); return new NewBindingKey(type, qualifier); }
From source file:org.apache.impala.service.BackendConfig.java
public static void create(TBackendGflags cfg) { Preconditions.checkNotNull(cfg); INSTANCE = new BackendConfig(cfg); initAuthToLocal(); }
From source file:cz.cuni.mff.ms.brodecva.botnicek.ide.utils.swing.components.hinters.IgnoreFireContentsChangedComboBoxModel.java
/** * Vytvo model./*from w ww .j a v a 2 s . c o m*/ * * @param list * seznam prvk * @return model */ public static <E> IgnoreFireContentsChangedComboBoxModel<E> create(final List<? extends E> list) { Preconditions.checkNotNull(list); return new IgnoreFireContentsChangedComboBoxModel<E>(ImmutableList.copyOf(list)); }
From source file:io.druid.query.QueryPlus.java
/** * Returns the minimum bare QueryPlus object with the given query. {@link #getQueryMetrics()} of the QueryPlus object, * returned from this factory method, returns {@code null}. *///from w w w .j a v a2 s. c om public static <T> QueryPlus<T> wrap(Query<T> query) { Preconditions.checkNotNull(query); return new QueryPlus<>(query, null); }
From source file:org.haiku.pkg.model.StringInlineAttribute.java
public StringInlineAttribute(AttributeId attributeId, String stringValue) { super(attributeId); Preconditions.checkNotNull(stringValue); this.stringValue = stringValue; }
From source file:com.enonic.cms.core.portal.ContentPath.java
public ContentPath(ContentKey contentKey, String contentName, Path pathToMenuItem) { Preconditions.checkNotNull(contentKey); this.contentKey = contentKey; this.contentName = contentName; this.pathToMenuItem = pathToMenuItem; }
From source file:de.doncarnage.minecraft.baseplugin.util.ItemUtil.java
/** * Returns the corresponding item for the given item and sub string. * * @param item the wanted item, e.g. log or step * @param sub the data byte of the material * @return a {@link MaterialData} instance reflecting this item *//*from w ww . j ava2 s .c o m*/ @SuppressWarnings("deprecation") public static MaterialData getMaterialDataByString(String item, String sub) { Preconditions.checkNotNull(item); Material mat = Material.getMaterial(item.toUpperCase()); if (mat == null) { return null; } MaterialData matData = new MaterialData(mat); if (!StringUtils.isBlank(sub)) { try { matData.setData(Byte.parseByte(sub)); } catch (NumberFormatException nfe) { return null; } } return matData; }