Class<?>[] params = readMethod.getParameterTypes(); if (params.length != 0) { throw new IntrospectionException("Bad read method arg count: " + readMethod); throw new IntrospectionException("Read method returns void: " + readMethod); Class<?>[] params = writeMethod.getParameterTypes(); if (params.length != 1) { throw new IntrospectionException("Bad write method arg count: " + writeMethod); throw new IntrospectionException( "Type mismatch between read and write methods: " + readMethod + " - " + writeMethod);
Class<?>[] params = indexedReadMethod.getParameterTypes(); if (params.length != 1) { throw new IntrospectionException("Bad indexed read method arg count: " + indexedReadMethod); throw new IntrospectionException("Non int index to indexed read method: " + indexedReadMethod); throw new IntrospectionException("Indexed read method returns void: " + indexedReadMethod); Class<?>[] params = indexedWriteMethod.getParameterTypes(); if (params.length != 2) { throw new IntrospectionException("Bad indexed write method arg count: " + indexedWriteMethod); throw new IntrospectionException("Non int index to indexed write method: " + indexedWriteMethod); throw new IntrospectionException("Type mismatch between indexed read and write methods: " + indexedReadMethod + " - " + indexedWriteMethod); throw new IntrospectionException("Type mismatch between indexed and non-indexed methods: " + indexedReadMethod + " - " + indexedWriteMethod);
Class<?>[] params = readMethod.getParameterTypes(); if (params.length != 0) { throw new IntrospectionException("Bad read method arg count: " + readMethod); throw new IntrospectionException("Read method returns void: " + readMethod); Class<?>[] params = writeMethod.getParameterTypes(); if (params.length != 1) { throw new IntrospectionException("Bad write method arg count: " + writeMethod); throw new IntrospectionException( "Type mismatch between read and write methods: " + readMethod + " - " + writeMethod);
/** * Find a method on a class with a specified number of parameters. */ private static Method getMethod(final Class<?> clazz, final String methodName, final int parameterCount) throws IntrospectionException { if (methodName == null) { return null; } final Method method = internalGetMethod(clazz, methodName, parameterCount); if (method != null) { return method; } // No Method found throw new IntrospectionException("No method \"" + methodName + "\" with " + parameterCount + " parameter(s)"); }
Class<?>[] params = indexedReadMethod.getParameterTypes(); if (params.length != 1) { throw new IntrospectionException("Bad indexed read method arg count: " + indexedReadMethod); throw new IntrospectionException("Non int index to indexed read method: " + indexedReadMethod); throw new IntrospectionException("Indexed read method returns void: " + indexedReadMethod); Class<?>[] params = indexedWriteMethod.getParameterTypes(); if (params.length != 2) { throw new IntrospectionException("Bad indexed write method arg count: " + indexedWriteMethod); throw new IntrospectionException("Non int index to indexed write method: " + indexedWriteMethod); throw new IntrospectionException("Type mismatch between indexed read and write methods: " + indexedReadMethod + " - " + indexedWriteMethod); throw new IntrospectionException("Type mismatch between indexed and non-indexed methods: " + indexedReadMethod + " - " + indexedWriteMethod);
/** * Find a method on a class with a specified number of parameters. */ private static Method getMethod(final Class<?> clazz, final String methodName, final int parameterCount) throws IntrospectionException { if (methodName == null) { return null; } final Method method = internalGetMethod(clazz, methodName, parameterCount); if (method != null) { return method; } // No Method found throw new IntrospectionException("No method \"" + methodName + "\" with " + parameterCount + " parameter(s)"); }
/** * Find a method on a class with a specified parameter list. */ private static Method getMethod(final Class<?> clazz, final String methodName, final Class<?>[] parameterTypes) throws IntrospectionException { if (methodName == null) { return null; } final Method method = MethodUtils.getMatchingAccessibleMethod(clazz, methodName, parameterTypes); if (method != null) { return method; } final int parameterCount = (parameterTypes == null) ? 0 : parameterTypes.length; // No Method found throw new IntrospectionException("No method \"" + methodName + "\" with " + parameterCount + " parameter(s) of matching types."); }
/** * Find a method on a class with a specified parameter list. */ private static Method getMethod(final Class<?> clazz, final String methodName, final Class<?>[] parameterTypes) throws IntrospectionException { if (methodName == null) { return null; } final Method method = MethodUtils.getMatchingAccessibleMethod(clazz, methodName, parameterTypes); if (method != null) { return method; } final int parameterCount = (parameterTypes == null) ? 0 : parameterTypes.length; // No Method found throw new IntrospectionException("No method \"" + methodName + "\" with " + parameterCount + " parameter(s) of matching types."); }
if (mappedReadMethod != null) { if (mappedReadMethod.getParameterTypes().length != 1) { throw new IntrospectionException ("bad mapped read method arg count"); throw new IntrospectionException ("mapped read method " + mappedReadMethod.getName() + " returns void"); final Class<?>[] params = mappedWriteMethod.getParameterTypes(); if (params.length != 2) { throw new IntrospectionException ("bad mapped write method arg count"); throw new IntrospectionException ("type mismatch between mapped read and write methods");
if (mappedReadMethod != null) { if (mappedReadMethod.getParameterTypes().length != 1) { throw new IntrospectionException ("bad mapped read method arg count"); throw new IntrospectionException ("mapped read method " + mappedReadMethod.getName() + " returns void"); final Class<?>[] params = mappedWriteMethod.getParameterTypes(); if (params.length != 2) { throw new IntrospectionException ("bad mapped write method arg count"); throw new IntrospectionException ("type mismatch between mapped read and write methods");
/** * This constructor takes the name of a mapped property, and Method * objects for reading and writing the property. * * @param propertyName The programmatic name of the property. * @param mappedGetter The method used for reading one of * the property values. May be be null if the property * is write-only. * @param mappedSetter The method used for writing one the * property values. May be null if the property is read-only. * * @throws IntrospectionException if an exception occurs during * introspection. */ public MappedPropertyDescriptor(final String propertyName, final Method mappedGetter, final Method mappedSetter) throws IntrospectionException { super(propertyName, mappedGetter, mappedSetter); if (propertyName == null || propertyName.length() == 0) { throw new IntrospectionException("bad property name: " + propertyName); } setName(propertyName); mappedReadMethodRef = new MappedMethodReference(mappedGetter); mappedWriteMethodRef = new MappedMethodReference(mappedSetter); findMappedPropertyType(); }
/** * This constructor takes the name of a mapped property, and Method * objects for reading and writing the property. * * @param propertyName The programmatic name of the property. * @param mappedGetter The method used for reading one of * the property values. May be be null if the property * is write-only. * @param mappedSetter The method used for writing one the * property values. May be null if the property is read-only. * * @throws IntrospectionException if an exception occurs during * introspection. */ public MappedPropertyDescriptor(final String propertyName, final Method mappedGetter, final Method mappedSetter) throws IntrospectionException { super(propertyName, mappedGetter, mappedSetter); if (propertyName == null || propertyName.length() == 0) { throw new IntrospectionException("bad property name: " + propertyName); } setName(propertyName); mappedReadMethodRef = new MappedMethodReference(mappedGetter); mappedWriteMethodRef = new MappedMethodReference(mappedSetter); findMappedPropertyType(); }
throw new IntrospectionException("bad property name: " + propertyName + " on class: " + beanClass.getClass().getName()); throw new IntrospectionException("Property '" + propertyName + "' not found on " + beanClass.getName());
throw new IntrospectionException("bad property name: " + propertyName + " on class: " + beanClass.getClass().getName()); throw new IntrospectionException("Property '" + propertyName + "' not found on " + beanClass.getName());
throw new IntrospectionException("bad property name: " + propertyName);
throw new IntrospectionException("bad property name: " + propertyName);
private static IntrospectionException mkie(Throwable t) { return (IntrospectionException) new IntrospectionException(t.toString()).initCause(t); }
public Beanspector<T> setValue(String setterName, Object value) throws Throwable { Method m = setters.get(setterName.toLowerCase()); if (m == null) { String msg = String.format("Setter '%s' not found, " + "known setters are: %s", setterName, setters.keySet()); throw new IntrospectionException(msg); } setValue(m, value); return this; }
/** * {@inheritDoc} */ public Object invoke(Object obj) throws Exception { if (obj != null && clazz.equals(obj.getClass())) { return new IndexedContainer(this, obj); } else { throw new IntrospectionException("property resolution error"); } }
@Override public Object invoke(Object obj) throws Exception { if (obj != null && clazz.equals(obj.getClass())) { return new IndexedContainer(this, obj); } else { throw new IntrospectionException("property resolution error"); } }