List of usage examples for java.lang.ref WeakReference WeakReference
public WeakReference(T referent)
From source file:org.brekka.stillingar.spring.pc.BeanPropertyChangeListener.java
/** * @param beanName// w w w . j ava 2 s . co m * The name of the bean that will be used to lookup its bean definition in the beanFactory. * @param property * The name of the property being updated. * @param beanFactory * Bean factory to lookup the bean in. * @param fragment * the fragment that will be used to evaluate and obtain the value which will be passed to * {@link #onChange(String)} */ public BeanPropertyChangeListener(String beanName, String property, BeanFactory beanFactory, Fragment fragment) { super(fragment); this.beanName = beanName; this.property = property; this.beanFactoryRef = new WeakReference<BeanFactory>(beanFactory); }
From source file:mx.com.adolfogarcia.popularmovies.net.FetchRatingMoviePageTaskFactory.java
/** * Creates a new instance of {@link FetchRatingMoviePageTaskFactory} * that creates instances of {@link FetchMoviePageTask} using the * provided arguments./*from ww w. j a v a 2 s .co m*/ * * @param configuration the configuration used to access movie pages. * @param context the context used to access the provider on which the * movie data will be stored. */ public FetchRatingMoviePageTaskFactory(RestfulServiceConfiguration configuration, Context context) { mWeakConfiguration = new WeakReference<>(configuration); mWeakContext = new WeakReference<>(context); }
From source file:mx.com.adolfogarcia.popularmovies.net.FetchPopularityMoviePageTaskFactory.java
/** * Creates a new instance of {@link FetchPopularityMoviePageTaskFactory} * that creates instances of {@link FetchMoviePageTask} using the * provided arguments.//ww w.j a va 2s.c om * * @param configuration the configuration used to access movie pages. * @param context the context used to access the provider on which the * movie data will be stored. */ public FetchPopularityMoviePageTaskFactory(RestfulServiceConfiguration configuration, Context context) { mWeakConfiguration = new WeakReference<>(configuration); mWeakContext = new WeakReference<>(context); }
From source file:com.swisscom.safeconnect.backend.PlumberTask.java
public PlumberTask(Context context) { this.context = new WeakReference<Context>(context); }
From source file:com.appnexus.opensdk.mediatedviews.AdMarvelBannerAdView.java
@Override public View requestAd(MediatedBannerAdViewController mBC, Activity activity, String parameter, String uid, int width, int height, TargetingParameters targetingParameters) { if (mBC != null) { if (!StringUtil.isEmpty(uid)) { try { JSONObject ids = new JSONObject(uid); String partnerId = ids.getString(AdMarvelListener.PARTNER_ID); String siteId = ids.getString(AdMarvelListener.SITE_ID); activityWeakReference = new WeakReference<Activity>(activity); adView = new AdMarvelView(activity); adView.setEnableClickRedirect(true); adView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); adView.setListener(new AdMarvelListener(mBC, this.getClass().getSimpleName())); adView.requestNewAd(AdMarvelListener.getTargetingParameters(targetingParameters), partnerId, siteId, activity); return adView; } catch (JSONException e) { }/*from ww w. ja v a 2 s . c o m*/ } Clog.d(Clog.mediationLogTag, "AdMarvel ids are not passed in properly, aborting ad request."); mBC.onAdFailed(ResultCode.INVALID_REQUEST); } return null; }
From source file:com.example.levelup.core.app.ProgressDialogLoaderCallbacks.java
/** * @param fragment the fragment displaying the progress dialog. This will be kept using a weak * reference./* www . ja va2 s. c om*/ * @param loaderId the ID of the loader that will be used with this dialog. * @param titleId the resource ID of the title string. * @param messageId the resource ID of the message string. * @param fragmentTag the tag of the progress dialog fragment. */ public ProgressDialogLoaderCallbacks(Fragment fragment, int loaderId, int titleId, int messageId, String fragmentTag) { mFragment = new WeakReference<Fragment>(fragment); mApplicationContext = fragment.getActivity().getApplicationContext(); mTitleId = titleId; mMessageId = messageId; mFragmentTag = fragmentTag; mLoaderId = loaderId; }
From source file:com.flowpowered.engine.entity.FlowEntitySnapshot.java
public FlowEntitySnapshot(Entity e) { if (e.isRemoved()) { throw new IllegalArgumentException("Can not take a snapshot of a removed entity"); }/*from w ww .j a v a 2s . com*/ this.entity = new WeakReference<>(e); this.entityId = e.getId(); this.uniqueId = e.getUID(); //this.location = e.getPhysics().getTransform(); this.location = null; this.worldName = e.getWorld().getName(); this.worldId = e.getWorld().refresh(e.getEngine().getWorldManager()).getUID(); this.savable = e.isSavable(); if (e.getData().size() > 0) { this.dataMap = e.getData().deepCopy(); } else { this.dataMap = new ManagedHashMap(); } components = new ArrayList<>(); for (Component c : e.values()) { if (c.isDetachable()) { this.components.add(c.getClass()); } } }
From source file:com.facebook.litho.DebugComponent.java
static synchronized DebugComponent getInstance(InternalNode node, int componentIndex) { final String globalKey = createKey(node, componentIndex); DebugComponent debugComponent = mDebugNodes.get(globalKey); if (debugComponent == null) { debugComponent = new DebugComponent(); mDebugNodes.put(globalKey, debugComponent); }/*from w w w . j a v a 2s .co m*/ debugComponent.mKey = globalKey; debugComponent.mNode = new WeakReference<>(node); debugComponent.mComponentIndex = componentIndex; return debugComponent; }
From source file:com.appnexus.opensdk.mediatedviews.AdMarvelInterstitialAdView.java
@Override public void requestAd(MediatedInterstitialAdViewController mIC, Activity activity, String parameter, String uid, TargetingParameters targetingParameters) { if (mIC != null) { if (!StringUtil.isEmpty(uid)) { try { JSONObject ids = new JSONObject(uid); String partnerId = ids.getString(AdMarvelListener.PARTNER_ID); String siteId = ids.getString(AdMarvelListener.SITE_ID); AdMarvelInterstitialAds.setEnableClickRedirect(true); weakReference = new WeakReference<Activity>(activity); adMarvelInterstitialAds = new AdMarvelInterstitialAds(activity); adMarvelListener = new AdMarvelListener(mIC, this.getClass().getSimpleName()); adMarvelInterstitialAds.setListener(adMarvelListener); adMarvelInterstitialAds.requestNewInterstitialAd(activity, AdMarvelListener.getTargetingParameters(targetingParameters), partnerId, siteId); return; } catch (JSONException e) { }/*from w w w . j a va 2s . c o m*/ } Clog.d(Clog.mediationLogTag, "AdMarvel partner id is not set, aborting ad request."); mIC.onAdFailed(ResultCode.INVALID_REQUEST); } }
From source file:at.ac.tuwien.infosys.jcloudscale.utility.ReferenceHashmap.java
@Override public V put(K key, V value) { int hash = System.identityHashCode(key); // add to key map List<WeakReference<K>> _keys = keys.get(hash); if (_keys == null) { _keys = new ArrayList<WeakReference<K>>(); keys.put(hash, _keys);//from ww w . j av a 2s .co m } _keys.add(new WeakReference<K>(key)); // add to value map List<Entry<WeakReference<K>, V>> _entries = values.get(hash); if (_entries == null) { _entries = new ArrayList<>(); values.put(hash, _entries); } _entries.add(new MapEntry<>(new WeakReference<K>(key), value)); size++; return null; }