Package jodd.introspector

Examples of jodd.introspector.Setter


    int len = Array.getLength(array);
    if (index >= len) {
      Object newArray = Array.newInstance(componentType, index + 1);
      System.arraycopy(array, 0, newArray, 0, len);

      Setter setter = bp.getSetter(true);
      if (setter == null) {
        throw new BeanException("Setter or field not found: " + bp.name, bp);
      }

      newArray = invokeSetter(setter, bp.bean, newArray);
View Full Code Here


  /**
   * Creates new instance for current property name through its setter.
   * It uses default constructor!
   */
  protected Object createBeanProperty(BeanProperty bp) {
    Setter setter = bp.getSetter(true);
    if (setter == null) {
      return null;
    }

    Class type = setter.getSetterRawType();

    Object newInstance;
    try {
      newInstance = ReflectUtil.newInstance(type);
    } catch (Exception ex) {
View Full Code Here

   * Sets a value of simple property.
   */
  @SuppressWarnings({"unchecked"})
  protected void setSimpleProperty(BeanProperty bp, Object value, boolean declared) {

    Setter setter = bp.getSetter(declared);

    // try: setter
    if (setter != null) {
      invokeSetter(setter, bp.bean, value);
      return;
View Full Code Here

      convertedValue = convertType(value, targetClass);
    }

    try {
      Setter setter = pd.getSetter(true);
      if (setter != null) {
        setter.invokeSetter(target, convertedValue);
      }
    } catch (Exception ex) {
      throw new JsonException(ex);
    }
  }
View Full Code Here

   * Sets the property value.
   */
  private void setValue(Object target, PropertyDescriptor pd, Object value) throws InvocationTargetException, IllegalAccessException {
    Class propertyType;

    Setter setter = pd.getSetter(true);
    if (setter != null) {
      if (value != null) {
        propertyType = setter.getSetterRawType();
        value = jsonParser.convertType(value, propertyType);
      }
      setter.invokeSetter(target, value);
    }
  }
View Full Code Here

        continue;
      }

      // BeanUtil.setDeclaredProperty(bean, pip.propertyDescriptor.getName(), value);

      Setter setter = pip.propertyDescriptor.getSetter(true);
      try {
        setter.invokeSetter(bean, value);
      }
      catch (Exception ex) {
        throw new PetiteException("Wiring failed", ex);
      }
    }

    // sets
    if (def.sets == null) {
      def.sets = petiteResolvers.resolveSetInjectionPoint(def.type, def.wiringMode == WiringMode.AUTOWIRE);
    }
    for (SetInjectionPoint sip : def.sets) {

      String[] beanNames = resolveBeanNamesForType(sip.targetClass);

      Collection beans = sip.createSet(beanNames.length);

      for (String beanName : beanNames) {
        if (beanName.equals(def.name) == false) {
          Object value = getBean(beanName, acquiredBeans);
          beans.add(value);
        }
      }

      //BeanUtil.setDeclaredProperty(bean, sip.field.getName(), beans);

      Setter setter = sip.propertyDescriptor.getSetter(true);
      try {
        setter.invokeSetter(bean, beans);
      }
      catch (Exception ex) {
        throw new PetiteException("Wiring failed", ex);
      }
    }
View Full Code Here

   * Sets a value of simple property.
   */
  @SuppressWarnings({"unchecked"})
  protected void setSimpleProperty(BeanProperty bp, Object value) {

    Setter setter = bp.getSetter(bp.declared);

    // try: setter
    if (setter != null) {
      invokeSetter(setter, bp, value);
      return;
View Full Code Here

    int len = Array.getLength(array);
    if (index >= len) {
      Object newArray = Array.newInstance(componentType, index + 1);
      System.arraycopy(array, 0, newArray, 0, len);

      Setter setter = bp.getSetter(true);
      if (setter == null) {
        // no point to check for bp.silent, throws NPE later
        throw new BeanException("Setter or field not found: " + bp.name, bp);
      }
View Full Code Here

  /**
   * Creates new instance for current property name through its setter.
   * It uses default constructor!
   */
  protected Object createBeanProperty(BeanProperty bp) {
    Setter setter = bp.getSetter(true);
    if (setter == null) {
      return null;
    }

    Class type = setter.getSetterRawType();

    Object newInstance;
    try {
      newInstance = ReflectUtil.newInstance(type);
    } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of jodd.introspector.Setter

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.