Package jodd.introspector

Examples of jodd.introspector.ClassDescriptor


  /**
   * Inspect action for all In/Out annotations.
   * Returns <code>null</code> if there are no In and Out data.
   */
  protected ScopeData inspectClassScopeData(Class actionClass, ScopeType scopeType) {
    ClassDescriptor cd = ClassIntrospector.lookup(actionClass);
    FieldDescriptor[] fields = cd.getAllFieldDescriptors();
    MethodDescriptor[] methods = cd.getAllMethodDescriptors();

    List<ScopeData.In> listIn = new ArrayList<ScopeData.In>(fields.length + methods.length);
    List<ScopeData.Out> listOut = new ArrayList<ScopeData.Out>(fields.length + methods.length);


View Full Code Here


    if (properties != null) {
      return properties;
    }

    ClassDescriptor cd = ClassIntrospector.lookup(type);
    PropertyDescriptor[] allProperties = cd.getAllPropertyDescriptors();

    List<PropertyDescriptor> list = new ArrayList<PropertyDescriptor>();

    for (PropertyDescriptor propertyDescriptor : allProperties) {
View Full Code Here

   */
  public void addClassChecks(Class target) {
    List<Check> list = cache.get(target);
    if (list == null) {
      list = new ArrayList<Check>();
      ClassDescriptor cd = ClassIntrospector.lookup(target);

      PropertyDescriptor[] allProperties = cd.getAllPropertyDescriptors();
      for (PropertyDescriptor propertyDescriptor : allProperties) {
        collectPropertyAnnotationChecks(list, propertyDescriptor);
      }

      cache.put(target, list);
View Full Code Here

  /**
   * Visits a type.
   */
  public void visit() {
    ClassDescriptor classDescriptor = ClassIntrospector.lookup(type);

    if (classMetadataName != null) {
      // process first 'meta' fields 'class'
      onProperty(classMetadataName, null, false);
    }

    PropertyDescriptor[] propertyDescriptors = classDescriptor.getAllPropertyDescriptors();

    for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {

      Getter getter = propertyDescriptor.getGetter(declared);
      if (getter != null) {
View Full Code Here

    if (targetType == Map.class) {
      return new HashMap();
    }

    ClassDescriptor cd = ClassIntrospector.lookup(targetType);

    CtorDescriptor ctorDescriptor = cd.getDefaultCtorDescriptor(true);
    if (ctorDescriptor == null) {
      throw new JsonException("Default ctor not found for: " + targetType.getClass().getName());
    }

    try {
View Full Code Here

    if (target == null) {
      target = jsonParser.newObjectInstance(targetType);
    }

    ClassDescriptor cd = ClassIntrospector.lookup(target.getClass());

    boolean targetIsMap = target instanceof Map;

    for (Object key : map.keySet()) {
      String keyName = key.toString();

      if (classMetadataName != null) {
        if (keyName.equals(classMetadataName)) {
          continue;
        }
      }

      PropertyDescriptor pd = cd.getPropertyDescriptor(keyName, declared);

      if (!targetIsMap && pd == null) {
        // target property does not exist, continue
        continue;
      }
View Full Code Here

      return false;
    }

    if (propertyType != null) {
      if (!jsonSerializer.deep) {
        ClassDescriptor propertyTypeClassDescriptor = ClassIntrospector.lookup(propertyType);

        if (propertyTypeClassDescriptor.isArray()) {
          return false;
        }
        if (propertyTypeClassDescriptor.isCollection()) {
          return false;
        }
        if (excludeMaps) {
          if (propertyTypeClassDescriptor.isMap()) {
            return false;
          }
        }
      }
View Full Code Here

      if (tjs != null) {
        return tjs;
      }

      ClassDescriptor cd = ClassIntrospector.lookup(type);

      // check array

      if (cd.isArray()) {
        return lookupSerializer(Arrays.class);
      }

      // now iterate interfaces

      Class[] interfaces = cd.getAllInterfaces();

      for (Class interfaze : interfaces) {
        tjs = lookupSerializer(interfaze);

        if (tjs != null) {
          return tjs;
        }
      }

      // now iterate all superclases

      Class[] superclasses = cd.getAllSuperclasses();

      for (Class clazz : superclasses) {
        tjs = lookupSerializer(clazz);

        if (tjs != null) {
View Full Code Here

    if (type.getAnnotation(JoddJson.jsonAnnotation) != null) {
      // current type has annotation, dont find anything, let type data be created
      return null;
    }

    ClassDescriptor cd = ClassIntrospector.lookup(type);

    // lookup superclasses

    Class[] superClasses = cd.getAllSuperclasses();

    for (Class superClass : superClasses) {
      if (superClass.getAnnotation(JoddJson.jsonAnnotation) != null) {
        // annotated subclass founded!
        return _lookupTypeData(superClass);
      }
    }

    Class[] interfaces = cd.getAllInterfaces();

    for (Class interfaze : interfaces) {
      if (interfaze.getAnnotation(JoddJson.jsonAnnotation) != null) {
        // annotated subclass founded!
        return _lookupTypeData(interfaze);
View Full Code Here

  /**
   * Scans class for annotations and returns {@link jodd.json.meta.JsonAnnotationManager.TypeData}.
   */
  private TypeData scanClassForAnnotations(Class type) {
    ClassDescriptor cd = ClassIntrospector.lookup(type);

    PropertyDescriptor[] pds = cd.getAllPropertyDescriptors();

    ArrayList<String> includedList = new ArrayList<String>();
    ArrayList<String> excludedList = new ArrayList<String>();
    ArrayList<String> jsonNames = new ArrayList<String>();
    ArrayList<String> realNames = new ArrayList<String>();
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.