Example usage for java.lang ClassCastException ClassCastException

List of usage examples for java.lang ClassCastException ClassCastException

Introduction

In this page you can find the example usage for java.lang ClassCastException ClassCastException.

Prototype

public ClassCastException(String s) 

Source Link

Document

Constructs a ClassCastException with the specified detail message.

Usage

From source file:com.ericbarnhill.arrayMath.MathArrayFloat1D.java

protected MathArrayFloat1D add(Complex g) {
    throw new ClassCastException("Cannot add Complex number to double array");
}

From source file:com.example.cuisoap.agrimac.homePage.machineDetail.driverInfoFragment.java

@Override
public void onAttach(Context context) {
    this.context = context;
    Activity activity = (Activity) context;
    try {// w  w w  .  j  a v  a  2s .  c  o  m
        mListener = (OnButtonClickListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnButtonClickListener");
    }
    super.onAttach(context);
}

From source file:com.ericbarnhill.arrayMath.MathArrayFloat2D.java

protected MathArrayFloat2D add(Complex g) {
    throw new ClassCastException("Cannot add Complex number to double array");
}

From source file:com.ericbarnhill.arrayMath.MathArrayFloat3D.java

protected MathArrayFloat3D add(Complex g) {
    throw new ClassCastException("Cannot add Complex number to double array");
}

From source file:com.cuddlesoft.nori.fragment.ImageFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {/*  ww w  . j  av  a 2 s. com*/
        listener = (ImageFragmentListener) getActivity();
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener");
    }
}

From source file:com.chenenyu.areapicker.AreaPicker.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    this.mActivity = (FragmentActivity) activity;
    try {/*  w w  w  .  j  ava  2s . c om*/
        mCallback = (OnAreaPickListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnAreaPickListener");
    }
}

From source file:com.walmartlabs.mupd8.application.Config.java

@SuppressWarnings("unchecked")
private static void apply(JSONObject destination, JSONObject source) {
    for (Object k : source.keySet()) {
        String key = (String) k;
        if (destination.containsKey(key) && (destination.get(key) != null)
                && (destination.get(key) instanceof JSONObject) && (source.get(key) instanceof JSONObject)) {
            try {
                JSONObject subDestination = (JSONObject) destination.get(key);
                JSONObject subSource = (JSONObject) source.get(key);
                apply(subDestination, subSource);
            } catch (ClassCastException e) {
                throw new ClassCastException("Config: cannot override key " + key
                        + " with new value because it is not a JSON object");
            }//from  w w  w.java  2 s.c o  m
        } else {
            destination.put(key, source.get(key));
        }
    }
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment32.java

@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 {//from  ww w.  j av  a 2  s  . c  o  m
        mCallback = (OnMainFragment32SelectedListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement OnMainFragment32SelectedListener");
    }
}

From source file:com.royclarkson.springagram.GalleryAddFragment.java

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {// ww w. j a  v  a  2s . c o  m
        galleryAddFragmentListener = (GalleryAddFragmentListener) activity;
    } catch (ClassCastException e) {
        throw new ClassCastException(activity.toString() + " must implement GalleryAddFragmentListener");
    }
}

From source file:com.ericbarnhill.arrayMath.MathArrayDouble1D.java

protected MathArrayDouble1D addC(Complex g) {
    throw new ClassCastException("Cannot add Complex number to double array");
}