Package com.antiaction.common.json.annotation

Examples of com.antiaction.common.json.annotation.JSON


    return json_om;
  }

  protected JSONObjectMapping mapClass(Class<?> clazz) throws JSONException {
    JSONObjectFieldMapping json_fm;
    JSON json;
    JSONIgnore ignore;

    JSONObjectMapping json_om = JSONObjectMapping.getObjectMapping();
    classMappings.put( clazz.getName(), json_om );

    Constructor<?> constructor = null;
    try {
      constructor = clazz.getConstructor( zeroArgsParameterTypes );
    }
    catch (NoSuchMethodException e) {
    }
    if ( constructor == null ) {
      throw new JSONException( clazz.getName() + " does not have a zero argument constructor!" );
    }

    json = clazz.getAnnotation( JSON.class );
    if ( json != null ) {
      String[] ignores = json.ignore();
      for ( int i=0; i<ignores.length; ++i) {
        json_om.ignore.add( ignores[ i ] );
      }
      String [] nullables = json.nullable();
      for ( int i=0; i<nullables.length; ++i ) {
        json_om.nullableSet.add( nullables[ i ] );
      }
      String[] nullValues = json.nullValues();
      for ( int i=0; i<nullValues.length; ++i ) {
        json_om.nullValuesSet.add( nullValues[ i ] );
      }
    }
View Full Code Here

TOP

Related Classes of com.antiaction.common.json.annotation.JSON

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.