List of usage examples for java.lang ClassCastException ClassCastException
public ClassCastException(String s)
ClassCastException
with the specified detail message. From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.list.TaskListFragment.java
@Override public void onAttach(Context context) { super.onAttach(context); try {/*www .j a v a 2s . co m*/ mListener = (TaskListFragment.TaskListCallbacks) getActivity(); } catch (ClassCastException e) { throw new ClassCastException("Activity must implement " + "OnFragmentInteractionListener"); } // We want to be notified of future changes to auto refresh PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this); }
From source file:com.ericbarnhill.arrayMath.MathArrayFloat1D.java
protected MathArrayFloat1D subtract(Complex g) { throw new ClassCastException("Cannot subtract Complex number to double array"); }
From source file:com.ericbarnhill.arrayMath.MathArrayFloat2D.java
protected MathArrayFloat2D subtract(Complex g) { throw new ClassCastException("Cannot subtract Complex number to double array"); }
From source file:com.ericbarnhill.arrayMath.MathArrayFloat3D.java
protected MathArrayFloat3D subtract(Complex g) { throw new ClassCastException("Cannot subtract Complex number to double array"); }
From source file:ezbake.data.elastic.thrift.FacetRequest.java
@Override protected void checkType(_Fields setField, Object value) throws ClassCastException { switch (setField) { case HISTOGRAM_FACET: if (value instanceof HistogramFacet) { break; }//w w w . ja v a 2 s. c o m throw new ClassCastException( "Was expecting value of type HistogramFacet for field 'histogramFacet', but got " + value.getClass().getSimpleName()); case RANGE_FACET: if (value instanceof RangeFacet) { break; } throw new ClassCastException("Was expecting value of type RangeFacet for field 'rangeFacet', but got " + value.getClass().getSimpleName()); case FILTER_FACET: if (value instanceof FilterFacet) { break; } throw new ClassCastException("Was expecting value of type FilterFacet for field 'filterFacet', but got " + value.getClass().getSimpleName()); case TERMS_FACET: if (value instanceof TermsFacet) { break; } throw new ClassCastException("Was expecting value of type TermsFacet for field 'termsFacet', but got " + value.getClass().getSimpleName()); case DATE_HISTOGRAM_FACET: if (value instanceof DateHistogramFacet) { break; } throw new ClassCastException( "Was expecting value of type DateHistogramFacet for field 'dateHistogramFacet', but got " + value.getClass().getSimpleName()); case TERMS_STATS_FACET: if (value instanceof TermsStatsFacet) { break; } throw new ClassCastException( "Was expecting value of type TermsStatsFacet for field 'termsStatsFacet', but got " + value.getClass().getSimpleName()); case STATISTICAL_FACET: if (value instanceof StatisticalFacet) { break; } throw new ClassCastException( "Was expecting value of type StatisticalFacet for field 'statisticalFacet', but got " + value.getClass().getSimpleName()); case TERMS_SCRIPT_FACET: if (value instanceof TermsScriptFacet) { break; } throw new ClassCastException( "Was expecting value of type TermsScriptFacet for field 'termsScriptFacet', but got " + value.getClass().getSimpleName()); default: throw new IllegalArgumentException("Unknown field id " + setField); } }
From source file:com.graphaware.common.util.PropertyContainerUtils.java
private static long getLong(String pc, String key, Object value) { if (value instanceof Byte) { return ((Byte) value).longValue(); }//from w w w .ja v a 2 s.c om if (value instanceof Integer) { return ((Integer) value).longValue(); } if (value instanceof Long) { return (Long) value; } throw new ClassCastException(value + " is not a number! (" + pc + ", key=" + key + ")"); }
From source file:com.mastfrog.acteur.server.ServerModule.java
public ServerModule(ReentrantScope scope, Class<A> appType, int workerThreadCount, int eventThreadCount, int backgroundThreadCount) { if (!Application.class.isAssignableFrom(appType)) { throw new ClassCastException( appType.getName() + " is not a subclass of " + Application.class.getName()); }// w w w. j a v a 2s . co m this.appType = appType; this.workerThreads = workerThreadCount; this.eventThreads = eventThreadCount; this.backgroundThreads = backgroundThreadCount; this.scope = scope; }
From source file:br.com.mybaby.contatos.ContactsListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/* w ww . ja v a 2 s . c o m*/ // Assign callback listener which the holding activity must implement. This is used // so that when a contact item is interacted with (selected by the user) the holding // activity will be notified and can take further action such as populating the contact // detail pane (if in multi-pane layout) or starting a new activity with the contact // details (single pane layout). mOnContactSelectedListener = (OnContactsInteractionListener) activity; activity.getIntent().putExtra(extraSMSTel, extraSMSTel); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnContactsInteractionListener"); } }
From source file:com.amazon.android.uamp.ui.PlaybackOverlayFragment.java
/** * {@inheritDoc}/* w ww . j a va 2s . c o m*/ */ @Override public void onAttach(Activity activity) { super.onAttach(activity); // This makes sure that the container activity has implemented the callback interface. If // not, it throws an exception. try { mCallback = (OnPlayPauseClickedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnPlayPauseClickedListener: " + e); } mContext = getActivity(); }
From source file:blackman.matt.infinitebrowser.NavigationDrawerFragment.java
/** * Called when the parent activity attached to this newly created fragment and checks * if the fragment interaction listener has be implemented by the activity. * * @param activity the parent activity of this fragment. *//*from w w w . ja v a2 s . c o m*/ @Override public void onAttach(Activity activity) { super.onAttach(activity); try { mCallbacks = (NavigationDrawerCallbacks) activity; } catch (ClassCastException e) { throw new ClassCastException("Activity must implement NavigationDrawerCallbacks."); } }