List of usage examples for java.lang ClassCastException ClassCastException
public ClassCastException(String s)
ClassCastException
with the specified detail message. From source file:com.androidinahurry.tunisiabanking.ui.BalanceFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from w w w . ja va2 s.c o m this.mListener = (LoadingViewListener) activity; } catch (final ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement LoadingViewListener"); } }
From source file:com.moscona.dataSpace.FactorValue.java
@SuppressWarnings({ "unchecked" }) public int compareTo(Object o) { if (factor.equals(((FactorValue<T>) o).getFactor())) { return CompareToBuilder.reflectionCompare(this, o); }/* www.j a v a 2 s . c o m*/ throw new ClassCastException("may not compare two factor values of different factors"); }
From source file:com.tdispatch.passenger.fragment.RegisterFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//w ww. ja v a 2 s . co m mHostActivity = (RegisterHostInterface) activity; } catch (ClassCastException e) { throw new ClassCastException("Host Activity needs to implement RegisterHostInterface"); } }
From source file:com.QuarkLabs.BTCeClient.fragments.HomeFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/* w w w . ja v a 2 s . c o m*/ mCallback = (ActivityCallbacks) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement ActivityCallbacks"); } }
From source file:com.sawyer.advadapters.app.adapters.jsonadapter.JSONAdapterFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof EventListener) { mEventListener = (EventListener) activity; } else {/*from w w w. j av a 2 s.c om*/ throw new ClassCastException("Activity must implement " + EventListener.class.getSimpleName()); } }
From source file:com.davidmascharka.lips.SelectRoomSizeDialogFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); // Verify the host activity implements the callback interface try {/*from w ww .j a va2 s . c o m*/ // Instantiate the listener so we can send events to the host listener = (SelectRoomSizeDialogListener) activity; } catch (ClassCastException e) { // The activity doesn't implement the interface throw new ClassCastException(activity.toString() + "must implement SelectRoomSizeDialogListener"); } }
From source file:com.example.cuisoap.agrimac.homePage.machineDetail.machineInfoFragment.java
@Override public void onAttach(Context context) { this.context = context; Activity activity = (Activity) context; try {//from www. j ava2s. c o m mListener = (OnButtonClickListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnButtonClickListener"); } super.onAttach(context); }
From source file:br.com.bioscada.apps.biotracks.fragments.ChooseActivityDialogFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*from w ww . j a va2 s . c om*/ caller = (ChooseActivityCaller) activity; } catch (ClassCastException e) { throw new ClassCastException( activity.toString() + " must implement " + ChooseActivityCaller.class.getSimpleName()); } }
From source file:io.aino.agents.wso2.mediator.serializer.AinoMediatorSerializer.java
@Override protected OMElement serializeSpecificMediator(Mediator mediator) { if (null == mediator) { throw new NullPointerException("Cannot serialize given mediator. It was passed as null."); }/*w ww. j ava 2 s . com*/ if (!(mediator instanceof AinoMediator)) { StringBuilder sb = new StringBuilder("Cannot serialize given mediator."); sb.append(" Its type should be: ").append(AinoMediator.class.getSimpleName()); sb.append(" Its type is: ").append(mediator.getType()); throw new ClassCastException(sb.toString()); } AinoMediator ainoMediator = (AinoMediator) mediator; OMElement logElement = fac.createOMElement(ROOT_TAG_NAME, synNS); addStatusToElement(ainoMediator, logElement); addOperationToElement(ainoMediator, logElement); addMessageToElement(ainoMediator, logElement); addIdsToElement(ainoMediator, logElement); addFromApplicationToElement(ainoMediator, logElement); addToApplicationToElement(ainoMediator, logElement); addPayloadTypeToElement(ainoMediator, logElement); addPropertiesToElement(ainoMediator, logElement); addSeparatorToElement(ainoMediator, logElement); return logElement; }
From source file:com.battlelancer.seriesguide.ui.dialogs.AddDialogFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*from w w w .j a v a 2 s . com*/ mListener = (OnAddShowListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnAddShowListener"); } }