001/*
002  Copyright 2010-2016 Boxfuse GmbH
003  <p/>
004  Licensed under the Apache License, Version 2.0 (the "License");
005  you may not use this file except in compliance with the License.
006  You may obtain a copy of the License at
007  <p/>
008  http://www.apache.org/licenses/LICENSE-2.0
009  <p/>
010  Unless required by applicable law or agreed to in writing, software
011  distributed under the License is distributed on an "AS IS" BASIS,
012  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013  See the License for the specific language governing permissions and
014  limitations under the License.
015 */
016package io.avaje.classpath.scanner.core;
017
018import android.content.Context;
019
020/**
021 * Holds an Android context. The context must be set for Flyway to be able to scan assets and classes for migrations.
022 *
023 * <p>
024 *     You can set this within an activity using ContextHolder.setContext(this);
025 * </p>
026 */
027public class AndriodContextHolder {
028  private AndriodContextHolder() {
029  }
030
031  /**
032   * The Android context to use.
033   */
034  private static Context context;
035
036  /**
037   * @return The Android context to use to be able to scan assets and classes for migrations.
038   */
039  public static Context getContext() {
040    return context;
041  }
042
043  /**
044   * @param context The Android context to use to be able to scan assets and classes for migrations.
045   */
046  public static void setContext(Context context) {
047    AndriodContextHolder.context = context;
048  }
049}