Package jodd.introspector

Examples of jodd.introspector.ClassDescriptor


   * @param type class type
   * @param staticMethodName static method name
   * @param arguments method argument types, may be <code>null</code>
   */
  public void registerPetiteProvider(String providerName, Class type, String staticMethodName, Class[] arguments) {
    ClassDescriptor cd = ClassIntrospector.lookup(type);
    MethodDescriptor md = cd.getMethodDescriptor(staticMethodName, arguments, true);

    if (md == null) {
      throw new PetiteException("Provider method not found: " + staticMethodName);
    }

View Full Code Here


    if (actionClass.getAnnotation(MadvocAction.class) == null) {
      return;
    }

    ClassDescriptor cd = ClassIntrospector.lookup(actionClass);

    MethodDescriptor[] allMethodDescriptors = cd.getAllMethodDescriptors();
    for (MethodDescriptor methodDescriptor : allMethodDescriptors) {
      if (!methodDescriptor.isPublic()) {
        continue;
      }
      // just public methods
View Full Code Here

  /**
   * Resolves all properties for given type.
   */
  public PropertyInjectionPoint[] resolve(Class type, boolean autowire) {
    // lookup fields
    ClassDescriptor cd = ClassIntrospector.lookup(type);
    List<PropertyInjectionPoint> list = new ArrayList<PropertyInjectionPoint>();
    PropertyDescriptor[] allPropertyDescriptors = cd.getAllPropertyDescriptors();

    for (PropertyDescriptor propertyDescriptor : allPropertyDescriptors) {

      if (propertyDescriptor.isGetterOnly()) {
        continue;
View Full Code Here

  /**
   * Resolves all collections for given type.
   */
  public SetInjectionPoint[] resolve(Class type, boolean autowire) {
    ClassDescriptor cd = ClassIntrospector.lookup(type);
    List<SetInjectionPoint> list = new ArrayList<SetInjectionPoint>();

    PropertyDescriptor[] allProperties = cd.getAllPropertyDescriptors();

    for (PropertyDescriptor propertyDescriptor : allProperties) {

      if (propertyDescriptor.isGetterOnly()) {
        continue;
View Full Code Here

    assertNotNull(ib.value());
    assertEquals(2, ib.value().length);


    // test method annotation
    ClassDescriptor cd = ClassIntrospector.lookup(clazz);
    Method m = cd.getMethodDescriptor("publicMethod", false).getMethod();
    assertNotNull(m);
    Annotation[] aa = m.getAnnotations();
    assertEquals(3, aa.length);
    Action a = (Action) aa[0];
    assertEquals("alias", a.alias());
View Full Code Here

    foo = BeanUtil.getProperty(lifeBean, "foo").toString();

    assertEquals("foo", foo);

    ClassDescriptor cd = JoddIntrospector.introspector.lookup(LifeBean.class);

    PropertyDescriptor[] pds = cd.getAllPropertyDescriptors();
    assertEquals(3, pds.length);

    assertEquals("bar", pds[0].getName());
    assertEquals("_bar", pds[0].getFieldDescriptor().getName());
View Full Code Here

    foo = BeanUtil.getProperty(lifeBean, "foo").toString();

    assertEquals("foo", foo);


    ClassDescriptor cd = JoddIntrospector.introspector.lookup(LifeBean.class);

    PropertyDescriptor[] pds = cd.getAllPropertyDescriptors();
    assertEquals(3, pds.length);

    assertEquals("bar", pds[0].getName());
    assertEquals("_bar", pds[0].getFieldDescriptor().getName());
View Full Code Here

  /**
   * Returns all bean property names.
   */
  protected String[] getAllBeanPropertyNames(Class type, boolean declared) {
    ClassDescriptor classDescriptor = ClassIntrospector.lookup(type);

    PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();

    ArrayList<String> names = new ArrayList<String>(propertyDescriptors.length);

    for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
      MethodDescriptor getter = propertyDescriptor.getReadMethodDescriptor();
View Full Code Here

    IsGetBool i = new IsGetBool();
    Object value = BeanUtil.getProperty(i, "flag");
    assertNotNull(value);
    assertTrue((Boolean) value);

    ClassDescriptor cd = ClassIntrospector.lookup(IsGetBool.class);

    PropertyDescriptor[] propertyDescriptors = cd.getAllPropertyDescriptors();

    assertEquals(1, propertyDescriptors.length);
    assertEquals("flag", propertyDescriptors[0].getName());
    assertEquals("isFlag", propertyDescriptors[0].getReadMethodDescriptor().getMethod().getName());
    MethodDescriptor[] mds = cd.getAllMethodDescriptors();
    int c = 0;
    for (MethodDescriptor md : mds) {
      if (md.isPublic()) c++;
    }
    assertEquals(3, c);

    GetIsBool i2 = new GetIsBool();
    value = BeanUtil.getProperty(i2, "flag");
    assertNotNull(value);
    assertTrue((Boolean) value);

    cd = ClassIntrospector.lookup(GetIsBool.class);
    assertEquals("flag", propertyDescriptors[0].getName());
    assertEquals("isFlag", propertyDescriptors[0].getReadMethodDescriptor().getMethod().getName());
    mds = cd.getAllMethodDescriptors();
    c = 0;
    for (MethodDescriptor md : mds) {
      if (md.isPublic()) c++;
    }
    assertEquals(3, c);
View Full Code Here

  @Test
  public void testAllBeanSetters() {
    Woof woof = new Woof();
    Class type = woof.getClass();
    ClassDescriptor cd = ClassIntrospector.lookup(type);
    PropertyDescriptor[] properties = cd.getAllPropertyDescriptors();
    assertNotNull(properties);
    assertEquals(7, properties.length);
  }
View Full Code Here

TOP

Related Classes of jodd.introspector.ClassDescriptor

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.