当前位置: 首页>>代码示例>>Java>>正文


Java Util.throwIfNull方法代码示例

本文整理汇总了Java中com.facebook.stetho.common.Util.throwIfNull方法的典型用法代码示例。如果您正苦于以下问题:Java Util.throwIfNull方法的具体用法?Java Util.throwIfNull怎么用?Java Util.throwIfNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.stetho.common.Util的用法示例。


在下文中一共展示了Util.throwIfNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeSQL

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public Database.ExecuteSQLResponse executeSQL(String databaseName, String query, ExecuteResultHandler<Database.ExecuteSQLResponse> handler)
        throws SQLiteException {
    Util.throwIfNull(query);
    Util.throwIfNull(handler);
    SQLiteDatabase database = openDatabase(databaseName);
    try {
        String firstWordUpperCase = getFirstWord(query).toUpperCase();
        switch (firstWordUpperCase) {
            case "UPDATE":
            case "DELETE":
                return executeUpdateDelete(database, query, handler);
            case "INSERT":
                return executeInsert(database, query, handler);
            case "SELECT":
            case "PRAGMA":
            case "EXPLAIN":
                return executeSelect(database, query, handler);
            default:
                return executeRawQuery(database, query, handler);
        }
    } finally {
        database.close();
    }
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:25,代码来源:RongDatabaseDriver.java

示例2: invokeMethod

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public void invokeMethod(String method, Object paramsObject,
    @Nullable PendingRequestCallback callback)
    throws NotYetConnectedException {
  Util.throwIfNull(method);

  Long requestId = (callback != null) ? preparePendingRequest(callback) : null;

  // magic, can basically convert anything for some amount of runtime overhead...
  JSONObject params = mObjectMapper.convertValue(paramsObject, JSONObject.class);

  JsonRpcRequest message = new JsonRpcRequest(requestId, method, params);
  String requestString;
  JSONObject jsonObject = mObjectMapper.convertValue(message, JSONObject.class);
  requestString = jsonObject.toString();
  mPeer.sendText(requestString);
}
 
开发者ID:facebook,项目名称:stetho,代码行数:17,代码来源:JsonRpcPeer.java

示例3: endInit

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public DescriptorMap endInit() {
  Util.throwIfNot(mIsInitializing);
  Util.throwIfNull(mHost);

  mIsInitializing = false;

  for (final Class<?> elementClass : mMap.keySet()) {
    final Descriptor descriptor = mMap.get(elementClass);

    if (descriptor instanceof ChainedDescriptor) {
      final ChainedDescriptor chainedDescriptor = (ChainedDescriptor) descriptor;
      Class<?> superClass = elementClass.getSuperclass();
      Descriptor superDescriptor = getImpl(superClass);
      chainedDescriptor.setSuper(superDescriptor);
    }

    descriptor.initialize(mHost);
  }

  return this;
}
 
开发者ID:facebook,项目名称:stetho,代码行数:22,代码来源:DescriptorMap.java

示例4: registerDescriptor

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
@Override
public DescriptorMap registerDescriptor(Class<?> elementClass, Descriptor descriptor) {
  Util.throwIfNull(elementClass);
  Util.throwIfNull(descriptor);
  Util.throwIf(descriptor.isInitialized());
  Util.throwIfNot(mIsInitializing);

  // Cannot register two descriptors for one class
  if (mMap.containsKey(elementClass)) {
    throw new UnsupportedOperationException();
  }

  // Cannot reuse one descriptor for two classes
  if (mMap.containsValue(descriptor)) {
    throw new UnsupportedOperationException();
  }

  mMap.put(elementClass, descriptor);
  return this;
}
 
开发者ID:facebook,项目名称:stetho,代码行数:21,代码来源:DescriptorMap.java

示例5: RIAndroidDocumentProviderFactory

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public RIAndroidDocumentProviderFactory(
    Application application,
    List<DescriptorProvider> descriptorProviders) {
  mApplication = Util.throwIfNull(application);
  mDescriptorProviders = Util.throwIfNull(descriptorProviders);
  mHandler = new Handler(Looper.getMainLooper());
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:8,代码来源:RIAndroidDocumentProviderFactory.java

示例6: RIAndroidDocumentProvider

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public RIAndroidDocumentProvider(
        Application application,
        List<DescriptorProvider> descriptorProviders,
        ThreadBound enforcer) {
    super(enforcer);

    mApplication = Util.throwIfNull(application);
    mDocumentRoot = new RIAndroidDocumentRoot();

    mDescriptorMap = new DescriptorMap()
            .beginInit()
            .registerDescriptor(RIAndroidDocumentRoot.class, mDocumentRoot)
            .registerDescriptor(Activity.class, new ActivityDescriptor())
            .registerDescriptor(Window.class, new WindowDescriptor())
            .registerDescriptor(Dialog.class, new DialogDescriptor())
            .registerDescriptor(View.class, new RIViewDescriptor())
            .registerDescriptor(ViewGroup.class, new ViewGroupDescriptor())
            .registerDescriptor(RINoActivatedActivityDescriptor.class, new RINoActivatedActivityDescriptor())
            .registerDescriptor(Object.class, new ObjectDescriptor());

    DialogFragmentDescriptor.register(mDescriptorMap);
    RIFragmentDescriptor.register(mDescriptorMap);

    for (int i = 0, size = descriptorProviders.size(); i < size; ++i) {
        final DescriptorProvider descriptorProvider = descriptorProviders.get(i);
        descriptorProvider.registerDescriptor(mDescriptorMap);
    }

    mDescriptorMap.setHost(this).endInit();

    mHighlighter = ViewHighlighter.newInstance();
    mInspectModeHandler = new InspectModeHandler();
}
 
开发者ID:nekocode,项目名称:ResourceInspector,代码行数:34,代码来源:RIAndroidDocumentProvider.java

示例7: LocalSocketServer

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
/**
 * @param friendlyName identifier to help debug this server, used for naming threads and such.
 * @param address the local socket address to listen on.
 * @param socketHandler functional handler once a socket is accepted.
 */
public LocalSocketServer(
    String friendlyName,
    String address,
    SocketHandler socketHandler) {
  mFriendlyName = Util.throwIfNull(friendlyName);
  mAddress = Util.throwIfNull(address);
  mSocketHandler = socketHandler;
}
 
开发者ID:facebook,项目名称:stetho,代码行数:14,代码来源:LocalSocketServer.java

示例8: AndroidDocumentProvider

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public AndroidDocumentProvider(
    Application application,
    List<DescriptorProvider> descriptorProviders,
    ThreadBound enforcer) {
  super(enforcer);

  mApplication = Util.throwIfNull(application);
  mDocumentRoot = new AndroidDocumentRoot(application);

  mDescriptorMap = new DescriptorMap()
      .beginInit()
      .registerDescriptor(Activity.class, new ActivityDescriptor())
      .registerDescriptor(AndroidDocumentRoot.class, mDocumentRoot)
      .registerDescriptor(Application.class, new ApplicationDescriptor())
      .registerDescriptor(Dialog.class, new DialogDescriptor())
      .registerDescriptor(Object.class, new ObjectDescriptor())
      .registerDescriptor(TextView.class, new TextViewDescriptor())
      .registerDescriptor(View.class, new ViewDescriptor())
      .registerDescriptor(ViewGroup.class, new ViewGroupDescriptor())
      .registerDescriptor(Window.class, new WindowDescriptor());

  DialogFragmentDescriptor.register(mDescriptorMap);
  FragmentDescriptor.register(mDescriptorMap);

  for (int i = 0, size = descriptorProviders.size(); i < size; ++i) {
    final DescriptorProvider descriptorProvider = descriptorProviders.get(i);
    descriptorProvider.registerDescriptor(mDescriptorMap);
  }

  mDescriptorMap.setHost(this).endInit();

  mHighlighter = ViewHighlighter.newInstance();
  mInspectModeHandler = new InspectModeHandler();
}
 
开发者ID:facebook,项目名称:stetho,代码行数:35,代码来源:AndroidDocumentProvider.java

示例9: AndroidDocumentProviderFactory

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public AndroidDocumentProviderFactory(
    Application application,
    List<DescriptorProvider> descriptorProviders) {
  mApplication = Util.throwIfNull(application);
  mDescriptorProviders = Util.throwIfNull(descriptorProviders);
  mHandler = new Handler(Looper.getMainLooper());
}
 
开发者ID:facebook,项目名称:stetho,代码行数:8,代码来源:AndroidDocumentProviderFactory.java

示例10: invoke

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
/**
 * Tries to invoke a method on receiver with a single argument by trying out different types
 * for arg until it finds one that matches (or not). No exceptions are thrown on failure.
 *
 * @param methodName The method name to be invoked
 * @param argument The single argument to be provided to the method
 */
public void invoke(Object receiver, String methodName, String argument) {
  Util.throwIfNull(receiver, methodName, argument);
  int size = invokers.size();
  for (int i = 0; i < size; ++i) {
    final TypedMethodInvoker<?> invoker = invokers.get(i);
    if (invoker.invoke(receiver, methodName, argument)) {
      return;
    }
  }
  LogUtil.w("Method with name " + methodName +
            " not found for any of the MethodInvoker supported argument types.");
}
 
开发者ID:facebook,项目名称:stetho,代码行数:20,代码来源:MethodInvoker.java

示例11: add

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public void add(Activity activity) {
  Util.throwIfNull(activity);
  Util.throwIfNot(Looper.myLooper() == Looper.getMainLooper());
  mActivities.add(new WeakReference<>(activity));
  for (Listener listener : mListeners) {
    listener.onActivityAdded(activity);
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:9,代码来源:ActivityTracker.java

示例12: remove

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public void remove(Activity activity) {
  Util.throwIfNull(activity);
  Util.throwIfNot(Looper.myLooper() == Looper.getMainLooper());
  if (removeFromWeakList(mActivities, activity)) {
    for (Listener listener : mListeners) {
      listener.onActivityRemoved(activity);
    }
  }
}
 
开发者ID:facebook,项目名称:stetho,代码行数:10,代码来源:ActivityTracker.java

示例13: openDatabase

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
private SQLiteDatabase openDatabase(String databaseName) throws SQLiteException {
    Util.throwIfNull(databaseName);
    return mDatabaseConnectionProvider.openDatabase(findDatabaseFile(databaseName));
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:5,代码来源:RongDatabaseDriver.java

示例14: JsonRpcPeer

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public JsonRpcPeer(ObjectMapper objectMapper, SimpleSession peer) {
  mObjectMapper = objectMapper;
  mPeer = Util.throwIfNull(peer);
}
 
开发者ID:facebook,项目名称:stetho,代码行数:5,代码来源:JsonRpcPeer.java

示例15: CSS

import com.facebook.stetho.common.Util; //导入方法依赖的package包/类
public CSS(Document document) {
  mDocument = Util.throwIfNull(document);
  mObjectMapper = new ObjectMapper();
  mPeerManager = new ChromePeerManager();
  mPeerManager.setListener(new PeerManagerListener());
}
 
开发者ID:facebook,项目名称:stetho,代码行数:7,代码来源:CSS.java


注:本文中的com.facebook.stetho.common.Util.throwIfNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。