List of usage examples for java.lang ClassCastException ClassCastException
public ClassCastException(String s)
ClassCastException
with the specified detail message. From source file:eionet.web.util.JstlFunctions.java
/** * * @param o/*from w w w. j av a2 s. c o m*/ * @param seperator * @return */ public static String join(Object o, String separator) { if (o == null) { return ""; } else if (o instanceof String) { return (String) o; } else if (o instanceof Object[]) { return StringUtils.join((Object[]) o, separator); } else if (o instanceof Collection) { return StringUtils.join((Collection) o, separator); } else { throw new ClassCastException("Couldn't cast from this class: " + o.getClass().getName()); } }
From source file:ch.berta.fabio.popularmovies.presentation.workerfragments.BaseWorker.java
@SuppressWarnings("unchecked") @Override/* ww w . j a v a2 s . c om*/ public void onAttach(Context context) { super.onAttach(context); try { mActivity = (T) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement WorkerInteractionListener"); } }
From source file:com.cuddlesoft.nori.fragment.AddTagFilterDialogFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*www . ja v a 2 s .c om*/ listener = (AddTagListener) getActivity(); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + "must implement OnFragmentInteractionListener"); } }
From source file:com.bytestemplar.tonedef.international.CountryListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from w ww . ja v a 2 s. c om mCallback = (OnCountrySelectedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement onCountrySelected"); } }
From source file:br.com.bioscada.apps.biotracks.fragments.ConfirmSyncDialogFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/* www . ja v a2 s.c o m*/ caller = (ConfirmSyncCaller) activity; } catch (ClassCastException e) { throw new ClassCastException( activity.toString() + " must implement " + ConfirmSyncCaller.class.getSimpleName()); } }
From source file:at.wada811.android.library.demos.app.TabFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof TabFragmentCallbackProvider == false) { throw new ClassCastException(activity.getLocalClassName() + " must implements " + TabFragmentCallbackProvider.class.getSimpleName()); }/* www.j a v a 2s . c o m*/ TabFragmentCallbackProvider provider = (TabFragmentCallbackProvider) activity; mCallback = provider.getTabCallback(); mCallback.onAttach(this); }
From source file:com.cisco.prototype.ledsignaldetection.Fragments.LoginFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from w ww . j a va 2 s .co m mListener = (BluetoothInterface) activity; mListener.writeData(""); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } }
From source file:jef.tools.Assert.java
/** * classc//w w w . j a v a 2 s . c o m * @param obj * @param c * @param msg */ public static void isType(Object obj, Class<?> c, String msg) { if (!(c.isAssignableFrom(obj.getClass()))) throw new ClassCastException(msg); }
From source file:br.com.PartoHumanizado.fragment.MenuDrawerFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/* ww w. j a v a 2 s . c o m*/ menuListener = (MenuListener) activity; } catch (ClassCastException e) { throw new ClassCastException("Activity must implement MenuListener."); } }
From source file:ca.mudar.parkcatcher.ui.fragments.DatePickerFragment.java
/** * Attach a listener./* w w w . j av a 2 s . c om*/ */ @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mListener = (OnParkingCalendarChangedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnParkingCalendarChangedListener"); } }