Package ch.softappeal.yass.serialize.fast

Examples of ch.softappeal.yass.serialize.fast.TypeHandler


    println();
  }

  private void generateFields(final ClassTypeHandler typeHandler) {
    for (final ClassTypeHandler.FieldDesc fieldDesc : typeHandler.fieldDescs()) {
      final TypeHandler fieldHandler = fieldDesc.handler.typeHandler();
      final String typeDescOwner;
      if (TypeDesc.LIST.handler == fieldHandler) {
        typeDescOwner = "yass.LIST";
      } else if (JsFastSerializer.BOOLEAN_TYPEDESC.handler == fieldHandler) {
        typeDescOwner = "yass.BOOLEAN";
View Full Code Here


    tabsln("'use strict';");
    tabsln("var contract = {};");
    tabsln("contract.YASS_VERSION = '%s';", Version.VALUE);
    println();
    for (final Map.Entry<Integer, TypeHandler> entry : id2typeHandler.entrySet()) {
      final TypeHandler typeHandler = entry.getValue();
      final Class<?> type = typeHandler.type;
      if (type.isEnum()) {
        generateEnum((Class<Enum<?>>)type);
      } else if (typeHandler instanceof ClassTypeHandler) {
        generateClass(type);
      }
    }
    final Class<?> clientServices = Class.forName(this.rootPackage + "ClientServices");
    final Class<?> serverServices = Class.forName(this.rootPackage + "ServerServices");
    final Set<Class<?>> interfacesSet = getInterfaces(clientServices);
    interfacesSet.addAll(getInterfaces(serverServices));
    final List<Class<?>> interfacesList = new ArrayList<>(interfacesSet);
    Collections.sort(interfacesList, new Comparator<Class<?>>() {
      @Override public int compare(final Class<?> type1, final Class<?> type2) {
        return type1.getCanonicalName().compareTo(type2.getCanonicalName());
      }
    });
    for (final Class<?> type : interfacesList) {
      generateInterface(type);
    }
    generateServices(clientServices);
    generateServices(serverServices);
    for (final Map.Entry<Integer, TypeHandler> entry : id2typeHandler.entrySet()) {
      final TypeHandler typeHandler = entry.getValue();
      if (typeHandler instanceof ClassTypeHandler) {
        generateFields((ClassTypeHandler)typeHandler);
      }
    }
    tabs("contract.SERIALIZER = yass.serializer(");
View Full Code Here

    }
    return jsType((Class<?>)type);
  }

  private String typeDescOwner(final ClassTypeHandler.FieldDesc fieldDesc) {
    final TypeHandler typeHandler = fieldDesc.handler.typeHandler();
    if (TypeDesc.LIST.handler == typeHandler) {
      return "yass.LIST_DESC";
    } else if (JsFastSerializer.BOOLEAN_TYPEDESC.handler == typeHandler) {
      return "yass.BOOLEAN_DESC";
    } else if (JsFastSerializer.INTEGER_TYPEDESC.handler == typeHandler) {
View Full Code Here

      if (type.isEnum()) {
        generateEnum((Class<Enum<?>>)type);
      }
    }
    for (final Map.Entry<Integer, TypeHandler> entry : id2typeHandler.entrySet()) {
      final TypeHandler typeHandler = entry.getValue();
      final Class<?> type = typeHandler.type;
      if (typeHandler instanceof ClassTypeHandler) {
        generateClass(type);
      }
    }
View Full Code Here

    }
    return jsType((Class<?>)type);
  }

  private String typeDescOwner(final ClassTypeHandler.FieldDesc fieldDesc) {
    final TypeHandler fieldHandler = fieldDesc.handler.typeHandler();
    if (TypeDesc.LIST.handler == fieldHandler) {
      return "yass.LIST";
    } else if (JsFastSerializer.BOOLEAN_TYPEDESC.handler == fieldHandler) {
      return "yass.BOOLEAN";
    } else if (JsFastSerializer.INTEGER_TYPEDESC.handler == fieldHandler) {
View Full Code Here

    super(contractFilePath);
    this.rootPackage = rootPackage.getName() + '.';
    this.methodMapperFactory = Check.notNull(methodMapperFactory);
    id2typeHandler = serializer.id2typeHandler();
    for (final Map.Entry<Integer, TypeHandler> entry : id2typeHandler.entrySet()) {
      final TypeHandler typeHandler = entry.getValue();
      final Class<?> type = typeHandler.type;
      if (type.isEnum() || (typeHandler instanceof ClassTypeHandler)) {
        type2id.put(type, entry.getKey());
      }
    }
    tabsln("import yass = require('%s');", Check.notNull(yassModulePath));
    println();
    tabsln("export var GENERATED_BY_YASS_VERSION = '%s';", Version.VALUE);
    println();
    for (final Map.Entry<Integer, TypeHandler> entry : id2typeHandler.entrySet()) {
      final TypeHandler typeHandler = entry.getValue();
      final Class<?> type = typeHandler.type;
      if (type.isEnum()) {
        generateEnum((Class<Enum<?>>)type);
      } else if (typeHandler instanceof ClassTypeHandler) {
        generateClass(type);
View Full Code Here

    }
    return jsType((Class<?>)type);
  }

  private String typeDescOwner(final ClassTypeHandler.FieldDesc fieldDesc) {
    final TypeHandler typeHandler = fieldDesc.handler.typeHandler();
    if (TypeDesc.LIST.handler == typeHandler) {
      return "yass.LIST_DESC";
    } else if (JsFastSerializer.BOOLEAN_TYPEDESC.handler == typeHandler) {
      return "yass.BOOLEAN_DESC";
    } else if (JsFastSerializer.INTEGER_TYPEDESC.handler == typeHandler) {
View Full Code Here

    }
    return jsType((Class<?>)type);
  }

  private String typeDescOwner(final ClassTypeHandler.FieldDesc fieldDesc) {
    final TypeHandler typeHandler = fieldDesc.handler.typeHandler();
    if (TypeDesc.LIST.handler == typeHandler) {
      return "yass.LIST_DESC";
    } else if (JsFastSerializer.BOOLEAN_TYPEDESC.handler == typeHandler) {
      return "yass.BOOLEAN_DESC";
    } else if (JsFastSerializer.INTEGER_TYPEDESC.handler == typeHandler) {
View Full Code Here

      if (type.isEnum()) {
        generateEnum((Class<Enum<?>>)type);
      }
    }
    for (final Map.Entry<Integer, TypeHandler> entry : id2typeHandler.entrySet()) {
      final TypeHandler typeHandler = entry.getValue();
      final Class<?> type = typeHandler.type;
      if (typeHandler instanceof ClassTypeHandler) {
        generateClass(type);
      }
    }
View Full Code Here

    }
    return jsType((Class<?>)type);
  }

  private String typeDescOwner(final ClassTypeHandler.FieldDesc fieldDesc) {
    final TypeHandler typeHandler = fieldDesc.handler.typeHandler();
    if (TypeDesc.LIST.handler == typeHandler) {
      return "yass.LIST_DESC";
    } else if (JsFastSerializer.BOOLEAN_TYPEDESC.handler == typeHandler) {
      return "yass.BOOLEAN_DESC";
    } else if (JsFastSerializer.INTEGER_TYPEDESC.handler == typeHandler) {
View Full Code Here

TOP

Related Classes of ch.softappeal.yass.serialize.fast.TypeHandler

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.