List of usage examples for java.lang ClassCastException ClassCastException
public ClassCastException(String s)
ClassCastException
with the specified detail message. From source file:ezbake.data.elastic.thrift.SortCriteria.java
@Override protected void checkType(_Fields setField, Object value) throws ClassCastException { switch (setField) { case GEO_SORT: if (value instanceof GeoDistanceSort) { break; }/*from w w w . j av a 2 s . c o m*/ throw new ClassCastException("Was expecting value of type GeoDistanceSort for field 'geoSort', but got " + value.getClass().getSimpleName()); case FIELD_SORT: if (value instanceof FieldSort) { break; } throw new ClassCastException("Was expecting value of type FieldSort for field 'fieldSort', but got " + value.getClass().getSimpleName()); default: throw new IllegalArgumentException("Unknown field id " + setField); } }
From source file:ezbake.data.elastic.thrift.DateInterval.java
@Override protected void checkType(_Fields setField, Object value) throws ClassCastException { switch (setField) { case CUSTOM_INTERVAL: if (value instanceof String) { break; }/*from w w w . ja v a 2s .co m*/ throw new ClassCastException("Was expecting value of type String for field 'customInterval', but got " + value.getClass().getSimpleName()); case STATIC_INTERVAL: if (value instanceof DateIntervalType) { break; } throw new ClassCastException( "Was expecting value of type DateIntervalType for field 'staticInterval', but got " + value.getClass().getSimpleName()); default: throw new IllegalArgumentException("Unknown field id " + setField); } }
From source file:ezbake.data.elastic.thrift.StatisticalFacet.java
@Override protected void checkType(_Fields setField, Object value) throws ClassCastException { switch (setField) { case FIELDS:// w ww. j a v a 2 s .co m if (value instanceof List) { break; } throw new ClassCastException("Was expecting value of type List<String> for field 'fields', but got " + value.getClass().getSimpleName()); case SCRIPT: if (value instanceof ValueScript) { break; } throw new ClassCastException("Was expecting value of type ValueScript for field 'script', but got " + value.getClass().getSimpleName()); default: throw new IllegalArgumentException("Unknown field id " + setField); } }
From source file:com.evolveum.midpoint.prism.PrismProperty.java
/** * Type override, also for compatibility. *///from ww w . j a v a 2 s . co m public <X> X getRealValue(Class<X> type) { if (getValue() == null) { return null; } X value = (X) getValue().getValue(); if (value == null) { return null; } if (type.isAssignableFrom(value.getClass())) { return (X) value; } else { throw new ClassCastException("Cannot cast value of property " + getElementName() + " which is of type " + value.getClass() + " to " + type); } }
From source file:com.ericbarnhill.arrayMath.MathArrayDouble1D.java
protected MathArrayDouble1D multiply(Complex g) { throw new ClassCastException("Cannot add Complex number to double array"); }
From source file:com.ericbarnhill.arrayMath.MathArrayDouble2D.java
protected MathArrayDouble2D multiply(Complex g) { throw new ClassCastException("Cannot add Complex number to double array"); }
From source file:com.ntsync.android.sync.activities.CreatePwdProgressDialog.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*from w w w . j a v a 2 s.co m*/ resultListener = (CreatePwdDialogListener) activity; } catch (ClassCastException e) { // The activity doesn't implement the interface, throw exception ClassCastException ex = new ClassCastException( activity.toString() + " must implement CreatePwdDialogListener"); ex.initCause(e); throw ex; } }
From source file:com.yairkukielka.feedhungry.EntryListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); if (activity instanceof MainActivity) { MainActivity act = (MainActivity) activity; act.setEntriesFragment(this); } else {//from w ww . j av a 2 s .c om throw new ClassCastException(activity.toString() + " must be MainActivity"); } }
From source file:com.cuddlesoft.nori.fragment.SearchResultGridFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); // Get a reference to parent activity, making sure that it implements the proper callback interface. try {/*from w w w . j ava 2 s . c o m*/ mListener = (OnSearchResultGridFragmentInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } }
From source file:com.ericbarnhill.arrayMath.MathArrayDouble3D.java
protected MathArrayDouble3D multiply(Complex g) { throw new ClassCastException("Cannot add Complex number to double array"); }