Package com.jaxws.json.feature

Examples of com.jaxws.json.feature.JSONWebService


       if (object == null) {
             this.add("null");
             return;
         }
       Class<?>       clazz       = object.getClass();
       JSONWebService   customInfo     = method != null ? method.getAnnotation(JSONWebService.class) : null;
      /*
        * Step 2. Find is it Object and cyclic reference.
        * Detect cyclic references
        * Object is not in cyclic reference the add it to cyclic stack.
        */
 
View Full Code Here


                    }
                     
                  /*
                     *  Step 5.10.2.4.3: read property custom config. If it is serializable continue process with specified name if any
                     */
                  JSONWebService properyConfig = accessor.getAnnotation(JSONWebService.class);
                   if (properyConfig != null) {
                         if (!properyConfig.serialize())
                             continue;
                         else if (properyConfig.name().length() > 0)
                             name = properyConfig.name();
                     }else{
                    /*
                     *  Step 5.10.2.4.4: JSON config not present. Then read XML configuration.
                     */   
                       try{
View Full Code Here

   * @return List of properties need to be excluded specific to operation call.
   * This values defined in implementation operation JSONWebService annotation.
   *
   */
  public static String[][] getInExProperties(JavaMethodImpl methodImpl){
    JSONWebService jsonService = methodImpl.getMethod().getAnnotation(JSONWebService.class);
    if(jsonService != null){
      return new String[][]{jsonService.includeProperties(),jsonService.excludeProperties()};
    }
    // default codec level
    return new String[][]{{},{}};
  }
View Full Code Here

        javaMethod = (JavaMethod) javaMethodAccessor.invoke(seiModel, operation.getName());
      }else{
        // TODO iterate all method and find
      }
      Method         seiMethod   = javaMethod.getSEIMethod();
      JSONWebService  jsonwebService  = javaMethod.getMethod().getAnnotation(JSONWebService.class);
      // Put codec specific properties in invoke
      invocationProperties.put(JSONCodec.globalMapKeyPattern_KEY, (jsonwebService == null || jsonwebService.listMapKey().isEmpty())?
          JSONCodec.globalMapKeyPattern : Pattern.compile(jsonwebService.listMapKey()));
      invocationProperties.put(JSONCodec.globalMapValuePattern_KEY, (jsonwebService == null || jsonwebService.listMapValue().isEmpty())?
          JSONCodec.globalMapValuePattern : Pattern.compile(jsonwebService.listMapValue()));
      //
     
      Map<String,Object>   operationParameters = (Map<String, Object>) invocationProperties.remove(JSONCodec.JSON_MAP_KEY);
     
      WSJSONPopulator   jsonPopulator     = new WSJSONPopulator((Pattern)invocationProperties.get(JSONCodec.globalMapKeyPattern_KEY),
View Full Code Here

    //iterate over class fields
    for (PropertyDescriptor prop : props) {
      Method         writeMethod     = prop.getWriteMethod();
      Class<?>       propertyType     = prop.getPropertyType();
        JSONWebService     writeMethodConfig   = writeMethod != null ? writeMethod.getAnnotation(JSONWebService.class) : null;
        String         expectedJSONPropName= (writeMethodConfig != null && !writeMethodConfig.name().isEmpty()) ? writeMethodConfig.name() : prop.getName();
        // JOSN input contains specified property.
        if (elements.containsKey(expectedJSONPropName)) {
          Object value   = elements.get(expectedJSONPropName);
            if (writeMethod != null) {
                if (writeMethodConfig != null
                    && !writeMethodConfig.deserialize()) {
                  if(traceEnabled){
                    traceLog.info(String.format("Ignoring property %s due to deserialize set to false", expectedJSONPropName));
                  }
                  continue;
                }
                //use only public setters Bean property describer get only accessable setter.
                  // Bean getter always works on single property get. if (paramTypes.length == 1) {
                  try{
                    Class<?>[]   paramTypes     = writeMethod.getParameterTypes();
                      Type[]     genericTypes   = writeMethod.getGenericParameterTypes();
                     
                    Object convertedValue = this.convert(paramTypes[0], genericTypes[0], value, writeMethodConfig, writeMethod);
                    writeMethod.invoke(object, convertedValue);
                  }catch(Throwable exp){
                    if(prop instanceof PublicFieldPropertyDescriptor){
                      ((PublicFieldPropertyDescriptor)prop).setValue(object, value);
                      }
                    if(traceEnabled){
                      traceLog.warn(String.format("Exception while writing property \"%s\". Input %s. Expected type %s",
                          expectedJSONPropName, value, propertyType.getSimpleName()));
                  }
                  }
                 // }
            } else if (prop.getReadMethod() != null && Collection.class.isAssignableFrom(propertyType)) {
          try {
            Method         readMethod       = prop.getReadMethod();
            JSONWebService     readMethodConfig   = readMethod.getAnnotation(JSONWebService.class);
            if(readMethodConfig == null || readMethodConfig.deserialize()){
              //  add configuration
              Collection<Object> objectList = (Collection<Object>) readMethod.invoke(object);
              if(objectList != null){
                if(traceEnabled){
                  traceLog.info(String.format("Only list read method found for property %s adding new values to existing collection. " +
View Full Code Here

TOP

Related Classes of com.jaxws.json.feature.JSONWebService

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.