Package org.apache.wicket

Examples of org.apache.wicket.WicketRuntimeException


  public final static Field getPropertyField(final String expression, final Object object)
  {
    ObjectAndGetSetter setter = getObjectAndGetSetter(expression, object, RESOLVE_CLASS);
    if (setter == null)
    {
      throw new WicketRuntimeException("Null object returned for expression: " + expression +
        " for getting the target classs of: " + object);
    }
    return setter.getField();
  }
View Full Code Here


  public final static Method getPropertyGetter(final String expression, final Object object)
  {
    ObjectAndGetSetter setter = getObjectAndGetSetter(expression, object, RESOLVE_CLASS);
    if (setter == null)
    {
      throw new WicketRuntimeException("Null object returned for expression: " + expression +
        " for getting the target classs of: " + object);
    }
    return setter.getGetter();
  }
View Full Code Here

  public final static Method getPropertySetter(final String expression, final Object object)
  {
    ObjectAndGetSetter setter = getObjectAndGetSetter(expression, object, RESOLVE_CLASS);
    if (setter == null)
    {
      throw new WicketRuntimeException("Null object returned for expression: " + expression +
        " for getting the target classs of: " + object);
    }
    return setter.getSetter();
  }
View Full Code Here

              {
                getAndSetter = new FieldGetAndSetter(field);
              }
              else
              {
                throw new WicketRuntimeException(
                  "The expression '" +
                    exp +
                    "' is neither an index nor is it a method or field for the list " +
                    clz);
              }
            }
          }
        }
        else if (Map.class.isAssignableFrom(clz))
        {
          getAndSetter = new MapGetSet(exp);
        }
        else if (clz.isArray())
        {
          try
          {
            int index = Integer.parseInt(exp);
            getAndSetter = new ArrayGetSet(clz.getComponentType(), index);
          }
          catch (NumberFormatException ex)
          {
            if (exp.equals("length") || exp.equals("size"))
            {
              getAndSetter = new ArrayLengthGetSet();
            }
            else
            {
              throw new WicketRuntimeException("Can't parse the expression '" + exp +
                "' as an index for an array lookup");
            }
          }
        }
        else
        {
          field = findField(clz, exp);
          if (field == null)
          {
            method = findMethod(clz, exp);
            if (method == null)
            {
              int index = exp.indexOf('.');
              if (index != -1)
              {
                String propertyName = exp.substring(0, index);
                String propertyIndex = exp.substring(index + 1);
                try
                {
                  int parsedIndex = Integer.parseInt(propertyIndex);
                  // if so then it could be a getPropertyIndex(int)
                  // and setPropertyIndex(int, object)
                  String name = Character.toUpperCase(propertyName.charAt(0)) +
                    propertyName.substring(1);
                  method = clz.getMethod(GET + name, new Class[] { int.class });
                  getAndSetter = new ArrayPropertyGetSet(method, parsedIndex);
                }
                catch (Exception e)
                {
                  throw new WicketRuntimeException(
                    "No get method defined for class: " + clz +
                      " expression: " + propertyName);
                }
              }
              else
              {
                // We do not look for a public FIELD because
                // that is not good programming with beans patterns
                throw new WicketRuntimeException(
                  "No get method defined for class: " + clz + " expression: " +
                    exp);
              }
            }
            else
View Full Code Here

          startPage(bookmarkablePageLink.getPageClass(), parameters);
        }
        catch (Exception e)
        {
          throw new WicketRuntimeException("Internal error in WicketTester. "
            + "Please report this in Wicket's Issue Tracker.", e);
        }
      }
      else if (link instanceof ResourceLink)
      {
View Full Code Here

     */
    @Override
    public void setValue(final Object object, final Object value,
      final PropertyResolverConverter converter)
    {
      throw new WicketRuntimeException("You can't set the length on an array:" + object);
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Object newValue(final Object object)
    {
      throw new WicketRuntimeException("Can't get a new value from a length of an array: " +
        object);
    }
View Full Code Here

      {
        ret = getMethod.invoke(object, index);
      }
      catch (InvocationTargetException ex)
      {
        throw new WicketRuntimeException("Error calling index property method: " +
          getMethod + " on object: " + object, ex.getCause());
      }
      catch (Exception ex)
      {
        throw new WicketRuntimeException("Error calling index property method: " +
          getMethod + " on object: " + object, ex);
      }
      return ret;
    }
View Full Code Here

        {
          setMethod.invoke(object, index, converted);
        }
        catch (InvocationTargetException ex)
        {
          throw new WicketRuntimeException("Error index property calling method: " +
            setMethod + " on object: " + object, ex.getCause());
        }
        catch (Exception ex)
        {
          throw new WicketRuntimeException("Error index property calling method: " +
            setMethod + " on object: " + object, ex);
        }
      }
      else
      {
        throw new WicketRuntimeException("No set method defined for value: " + value +
          " on object: " + object);
      }
    }
View Full Code Here

      {
        ret = getMethod.invoke(object, (Object[])null);
      }
      catch (InvocationTargetException ex)
      {
        throw new WicketRuntimeException("Error calling method: " + getMethod +
          " on object: " + object, ex.getCause());
      }
      catch (Exception ex)
      {
        throw new WicketRuntimeException("Error calling method: " + getMethod +
          " on object: " + object, ex);
      }
      return ret;
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.WicketRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.