com.facebook.FacebookGraphObjectException Java Examples
The following examples show how to use
com.facebook.FacebookGraphObjectException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadSetterParams() { try { GraphObject.Factory.create(BadSetterParamsGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #2
Source File: GraphObject.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #3
Source File: GraphObject.java From HypFacebook with BSD 2-Clause "Simplified" License | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #4
Source File: GraphObject.java From facebook-api-android-maven with Apache License 2.0 | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #5
Source File: GraphObject.java From KlyphMessenger with MIT License | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #6
Source File: GraphObject.java From Abelana-Android with Apache License 2.0 | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #7
Source File: GraphObject.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #8
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCannotCastCollectionOfNonGraphObjects() throws JSONException { try { GraphObjectList<Integer> collection = GraphObject.Factory.createList(Integer.class); collection.castToListOf(GraphLocation.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #9
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadPropertyNameOverrides() { try { GraphObject.Factory.create(BadPropertyOverrideInterfaceGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #10
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadBaseInterface() { try { GraphObject.Factory.create(BadBaseInterfaceGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #11
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadSetterReturnType() { try { GraphObject.Factory.create(BadSetterReturnTypeGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #12
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadSetterName() { try { GraphObject.Factory.create(BadSetterNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #13
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadGetterReturnType() { try { GraphObject.Factory.create(BadGetterReturnTypeGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #14
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadGetterParams() { try { GraphObject.Factory.create(BadGetterParamsGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #15
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadGetterName() { try { GraphObject.Factory.create(BadGetterNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #16
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadSingleParameterMethodName() { try { GraphObject.Factory.create(BadSingleParameterMethodNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #17
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapNonInterface() { try { GraphObject.Factory.create(GraphObjectClass.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #18
Source File: GraphObject.java From Klyph with MIT License | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #19
Source File: GraphObject.java From barterli_android with Apache License 2.0 | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #20
Source File: GraphObject.java From platform-friends-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #21
Source File: GraphObject.java From android-skeleton-project with MIT License | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #22
Source File: GraphObjectFactoryTests.java From FacebookImageShareIntent with MIT License | 5 votes |
@SmallTest @MediumTest @LargeTest public void testCantWrapBadZeroParameterMethodName() { try { GraphObject.Factory.create(BadNoParameterMethodNameGraphObject.class); fail("Expected exception"); } catch (FacebookGraphObjectException exception) { } }
Example #23
Source File: GraphObject.java From FacebookImageShareIntent with MIT License | 5 votes |
@Override public final <U extends GraphObject> GraphObjectList<U> castToListOf(Class<U> graphObjectClass) { if (GraphObject.class.isAssignableFrom(itemType)) { if (graphObjectClass.isAssignableFrom(itemType)) { @SuppressWarnings("unchecked") GraphObjectList<U> result = (GraphObjectList<U>)this; return result; } return createList(state, graphObjectClass); } else { throw new FacebookGraphObjectException("Can't cast GraphObjectCollection of non-GraphObject type " + itemType); } }
Example #24
Source File: GraphObject.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 4 votes |
protected final Object throwUnexpectedMethodSignature(Method method) { throw new FacebookGraphObjectException(getClass().getName() + " got an unexpected method signature: " + method.toString()); }
Example #25
Source File: GraphObject.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 4 votes |
private static <T extends GraphObject> void verifyCanProxyClass(Class<T> graphObjectClass) { if (hasClassBeenVerified(graphObjectClass)) { return; } if (!graphObjectClass.isInterface()) { throw new FacebookGraphObjectException("Factory can only wrap interfaces, not class: " + graphObjectClass.getName()); } Method[] methods = graphObjectClass.getMethods(); for (Method method : methods) { String methodName = method.getName(); int parameterCount = method.getParameterTypes().length; Class<?> returnType = method.getReturnType(); boolean hasPropertyNameOverride = method.isAnnotationPresent(PropertyName.class); if (method.getDeclaringClass().isAssignableFrom(GraphObject.class)) { // Don't worry about any methods from GraphObject or one of its base classes. continue; } else if (parameterCount == 1 && returnType == Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("set") && methodName.length() > 3) { // Looks like a valid setter continue; } } else if (parameterCount == 0 && returnType != Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("get") && methodName.length() > 3) { // Looks like a valid getter continue; } } throw new FacebookGraphObjectException("Factory can't proxy method: " + method.toString()); } recordClassHasBeenVerified(graphObjectClass); }
Example #26
Source File: GraphObject.java From HypFacebook with BSD 2-Clause "Simplified" License | 4 votes |
protected final Object throwUnexpectedMethodSignature(Method method) { throw new FacebookGraphObjectException(getClass().getName() + " got an unexpected method signature: " + method.toString()); }
Example #27
Source File: GraphObject.java From HypFacebook with BSD 2-Clause "Simplified" License | 4 votes |
private static <T extends GraphObject> void verifyCanProxyClass(Class<T> graphObjectClass) { if (hasClassBeenVerified(graphObjectClass)) { return; } if (!graphObjectClass.isInterface()) { throw new FacebookGraphObjectException("Factory can only wrap interfaces, not class: " + graphObjectClass.getName()); } Method[] methods = graphObjectClass.getMethods(); for (Method method : methods) { String methodName = method.getName(); int parameterCount = method.getParameterTypes().length; Class<?> returnType = method.getReturnType(); boolean hasPropertyNameOverride = method.isAnnotationPresent(PropertyName.class); if (method.getDeclaringClass().isAssignableFrom(GraphObject.class)) { // Don't worry about any methods from GraphObject or one of its base classes. continue; } else if (parameterCount == 1 && returnType == Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("set") && methodName.length() > 3) { // Looks like a valid setter continue; } } else if (parameterCount == 0 && returnType != Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("get") && methodName.length() > 3) { // Looks like a valid getter continue; } } throw new FacebookGraphObjectException("Factory can't proxy method: " + method.toString()); } recordClassHasBeenVerified(graphObjectClass); }
Example #28
Source File: GraphObject.java From Klyph with MIT License | 4 votes |
private static <T extends GraphObject> void verifyCanProxyClass(Class<T> graphObjectClass) { if (hasClassBeenVerified(graphObjectClass)) { return; } if (!graphObjectClass.isInterface()) { throw new FacebookGraphObjectException("Factory can only wrap interfaces, not class: " + graphObjectClass.getName()); } Method[] methods = graphObjectClass.getMethods(); for (Method method : methods) { String methodName = method.getName(); int parameterCount = method.getParameterTypes().length; Class<?> returnType = method.getReturnType(); boolean hasPropertyNameOverride = method.isAnnotationPresent(PropertyName.class); if (method.getDeclaringClass().isAssignableFrom(GraphObject.class)) { // Don't worry about any methods from GraphObject or one of its base classes. continue; } else if (parameterCount == 1 && returnType == Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("set") && methodName.length() > 3) { // Looks like a valid setter continue; } } else if (parameterCount == 0 && returnType != Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("get") && methodName.length() > 3) { // Looks like a valid getter continue; } } throw new FacebookGraphObjectException("Factory can't proxy method: " + method.toString()); } recordClassHasBeenVerified(graphObjectClass); }
Example #29
Source File: GraphObject.java From facebook-api-android-maven with Apache License 2.0 | 4 votes |
protected final Object throwUnexpectedMethodSignature(Method method) { throw new FacebookGraphObjectException(getClass().getName() + " got an unexpected method signature: " + method.toString()); }
Example #30
Source File: GraphObject.java From facebook-api-android-maven with Apache License 2.0 | 4 votes |
private static <T extends GraphObject> void verifyCanProxyClass(Class<T> graphObjectClass) { if (hasClassBeenVerified(graphObjectClass)) { return; } if (!graphObjectClass.isInterface()) { throw new FacebookGraphObjectException("Factory can only wrap interfaces, not class: " + graphObjectClass.getName()); } Method[] methods = graphObjectClass.getMethods(); for (Method method : methods) { String methodName = method.getName(); int parameterCount = method.getParameterTypes().length; Class<?> returnType = method.getReturnType(); boolean hasPropertyNameOverride = method.isAnnotationPresent(PropertyName.class); if (method.getDeclaringClass().isAssignableFrom(GraphObject.class)) { // Don't worry about any methods from GraphObject or one of its base classes. continue; } else if (parameterCount == 1 && returnType == Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("set") && methodName.length() > 3) { // Looks like a valid setter continue; } } else if (parameterCount == 0 && returnType != Void.TYPE) { if (hasPropertyNameOverride) { // If a property override is present, it MUST be valid. We don't fallback // to using the method name if (!Utility.isNullOrEmpty(method.getAnnotation(PropertyName.class).value())) { continue; } } else if (methodName.startsWith("get") && methodName.length() > 3) { // Looks like a valid getter continue; } } throw new FacebookGraphObjectException("Factory can't proxy method: " + method.toString()); } recordClassHasBeenVerified(graphObjectClass); }