Package rocket.generator.rebind.type

Examples of rocket.generator.rebind.type.Type


    final GeneratorContext context = this.getGeneratorContext();

    // locate the writeFields method that will be overridden.
    final List<Type> parameterTypes = new ArrayList<Type>();
    parameterTypes.add(context.getObject());
    final Type objectInputStreamType = this.getObjectInputStream();
    parameterTypes.add(objectInputStreamType);

    final Method method = reader.getMostDerivedMethod(SerializationConstants.CLIENT_OBJECT_READER_IMPL_READ_METHOD, parameterTypes);
    final NewMethod newMethod = method.copy(reader);
    newMethod.setNative(false);
View Full Code Here


    final NewMethodParameter value = method.newParameter();
    value.setFinal(true);
    value.setName(SerializationConstants.CLIENT_OBJECT_READER_IMPL_FIELD_SETTER_VALUE_PARAMETER);

    final Type fieldType = field.getType();
    value.setType(fieldType);

    if (fieldType.equals(context.getLong())) {
      method.addMetaData("com.google.gwt.core.client.UnsafeNativeLong", "");
    }

    context.debug(field.getName());
View Full Code Here

    final Iterator<Type> types = orderedSerializables.iterator();
    int skippedGeneratingCount = 0;
    final Set<Type> newWriters = new TreeSet<Type>(TypeComparator.INSTANCE);

    while (types.hasNext()) {
      final Type type = (Type) types.next();
      final Object writer = typesToWriters.get(type);

      if (null != writer) {
        skippedGeneratingCount++;
        continue;
View Full Code Here

    context.debug(newTypeName);

    // check super class of type. if its not object extend its object writer
    // rather than cowi.
    Type objectWriterSuperType = null;

    while (true) {
      if (type.isArray()) {
        objectWriterSuperType = this.getArrayWriter();
        break;
      }
      final Type superType = type.getSuperType();
      if (superType.equals(context.getObject())) {
        objectWriterSuperType = this.getObjectWriterImpl();
        break;
      }

      objectWriterSuperType = (Type) serializables.get(type.getSuperType());
View Full Code Here

    method.setBody(body);
    method.setFinal(true);
    method.setName(GeneratorHelper.buildGetterName(field.getName()));
    method.setNative(true);

    final Type fieldType = field.getType();
    method.setReturnType(fieldType);
    method.setStatic(false);
    method.setVisibility(Visibility.PRIVATE);

    if (fieldType.equals(context.getLong())) {
      method.addMetaData("com.google.gwt.core.client.UnsafeNativeLong", "");
    }
    // add a parameter
    final NewMethodParameter instance = method.newParameter();
    instance.setFinal(true);
View Full Code Here

    singleton.setValue(body);

    singleton.setFinal(true);
    singleton.setName(SerializationConstants.SINGLETON);
    final Type returnType = type;
    singleton.setType(returnType);
    singleton.setStatic(true);
    singleton.setVisibility(Visibility.PUBLIC);

    this.getGeneratorContext().debug(type.getName());
View Full Code Here

    final Iterator<Map.Entry<Type, Type>> iterator = objectReaders.entrySet().iterator();
    while (iterator.hasNext()) {
      final Map.Entry<Type, Type> entry = iterator.next();

      final Type type = entry.getKey();
      if (false == this.isSerializable(type)) {
        continue;
      }

      final Type objectReader = entry.getValue();
      final Field objectReaderSingleton = objectReader.getField(SerializationConstants.SINGLETON);

      body.register(type, objectReaderSingleton);

      context.debug(type.getName() + " = " + objectReader.getName());
    }

    newMethod.setBody(body);

    context.unbranch();
View Full Code Here

    final Iterator<Map.Entry<Type, Type>> iterator = objectWriters.entrySet().iterator();
    while (iterator.hasNext()) {
      final Map.Entry<Type, Type> entry = iterator.next();

      final Type type = entry.getKey();
      if (false == this.isSerializable(type)) {
        continue;
      }

      final Type objectWriter = entry.getValue();
      final Field objectWriterSingleton = objectWriter.getField(SerializationConstants.SINGLETON);

      body.register(type, objectWriterSingleton);

      context.debug(type.getName() + " = " + objectWriter.getName());
    }

    newMethod.setBody(body);

    context.unbranch();
View Full Code Here

   * @return The constructor, will never be null.
   */
  protected Constructor getConstructorForLoggingLevel(final LoggingLevel loggingLevel) {
    Checker.notNull("parameter:loggingLevel", loggingLevel);

    Type type = null;
    while (true) {
      if (LoggingLevel.DEBUG == loggingLevel) {
        type = this.getDebugLevelLogger();
        break;
      }
      if (LoggingLevel.INFO == loggingLevel) {
        type = this.getInfoLevelLogger();
        break;
      }
      if (LoggingLevel.WARN == loggingLevel) {
        type = this.getWarnLevelLogger();
        break;
      }
      if (LoggingLevel.ERROR == loggingLevel) {
        type = this.getErrorLevelLogger();
        break;
      }
      if (LoggingLevel.FATAL == loggingLevel) {
        type = this.getFatalLevelLogger();
        break;
      }
      if (LoggingLevel.NONE == loggingLevel) {
        type = this.getNoneLevelLogger();
        break;
      }

      throw new LoggerFactoryGeneratorException("Unknown logging level " + loggingLevel);
    }

    // find constructor
    return type.getConstructor(Collections.nCopies(1, this.getLogger()));
  }
View Full Code Here

  protected Constructor getTargetLoggerConstructor(final String typeName) {
    final GeneratorContext context = this.getGeneratorContext();
    context.branch();
    context.debug(typeName);

    final Type type = context.getType(typeName);
    context.debug(type.toString());

    // make sure type is really a Logger.
    final Type logger = this.getLogger();
    if (false == type.isAssignableTo(logger)) {
      throwTargetLoggerIsNotALogger(type);
    }
    if (type.isInterface()) {
      throwTargetLoggerIsAnInterface(type);
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.type.Type

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.