Package rocket.generator.rebind.type

Examples of rocket.generator.rebind.type.Type


    String fileName = null;

    while (true) {
      final MethodParameter parameter = this.getParameter();
      final GeneratorContext context = parameter.getGeneratorContext();
      final Type type = parameter.getType();
      if (type.equals(context.getBoolean())) {
        fileName = Constants.BOOLEAN;
        break;
      }
      if (type.equals(context.getByte())) {
        fileName = Constants.BYTE;
        break;
      }
      if (type.equals(context.getShort())) {
        fileName = Constants.SHORT;
        break;
      }
      if (type.equals(context.getInt())) {
        fileName = Constants.INT;
        break;
      }
      if (type.equals(context.getLong())) {
        fileName = Constants.LONG;
        break;
      }
      if (type.equals(context.getFloat())) {
        fileName = Constants.FLOAT;
        break;
      }
      if (type.equals(context.getDouble())) {
        fileName = Constants.DOUBLE;
        break;
      }
      if (type.equals(context.getChar())) {
        fileName = Constants.CHAR;
        break;
      }
      fileName = Constants.OBJECT;
      break;
View Full Code Here


  @Override
  protected String getResourceName() {
    String fileName = null;
    while (true) {
      // the return type of the getter is also the field type.
      final Type type = this.getFieldType();
      final GeneratorContext context = type.getGeneratorContext();
      if (context.getBoolean().equals(type)) {
        fileName = Constants.READ_FIELD_BOOLEAN_FIELD_TEMPLATE;
        break;
      }
      if (context.getByte().equals(type)) {
View Full Code Here

  public String getRuntimeName() {
    // for java.lang.String array the runtime name or signature is
    // [Ljava.lang.String;
    // for a two dimensioned String array the runtime name is
    // [[Ljava.lang.String;
    final Type componentType = this.getComponentType();
    final boolean primitiveComponentType = componentType.isPrimitive();

    final StringBuffer runtimeName = new StringBuffer();
    final JArrayType jArrayType = this.getJArrayType();

    // prefix a [ for each rank.
    final int rank = jArrayType.getRank();
    for (int i = 0; i < rank; i++) {
      runtimeName.append('[');
    }

    if (false == primitiveComponentType) {
      runtimeName.append("L");
    }

    // insert the name.
    final String name = componentType.getRuntimeName();
    final Package packagee = componentType.getPackage();
    final String packageName = null == packagee ? null : packagee.getName();
    String nameLessPackageName = name;

    if (false == Tester.isNullOrEmpty(packageName)) {
      runtimeName.append(packageName);
View Full Code Here

  protected TypeOracleGeneratorContext getTypeOracleGeneratorContext(){
    return (TypeOracleGeneratorContext) this.getGeneratorContext();
  }

  public Type getSuperType() {
    Type superType = null;
    final JType superJType = this.getJClassType().getSuperclass();
    if (null != superJType) {
      superType = this.getTypeOracleGeneratorContext().getType( superJType );
    }
View Full Code Here

    return this.getTypeOracle().findPackage(name);
  }

  @Override
  protected Type createType(final String name) {
    Type type = null;

    while( true ){
      final TypeOracle typeOracle = this.getTypeOracle();
      if( name.endsWith("[]")){
        final String componentTypeName = name.substring(0, name.length() - 2);
View Full Code Here

  }

  public Type getType( final JType jType ){
    Checker.notNull("parameter:jType", jType );
   
    Type type = null;
   
    while( true ){
      if( jType instanceof JPrimitiveType ){
        type = this.getType( jType.getQualifiedSourceName() );
        break;
View Full Code Here

    buf.append('(');

    final Iterator parameters = this.getParameters().iterator();
    while (parameters.hasNext()) {
      final ConstructorParameter parameter = (ConstructorParameter) parameters.next();
      final Type parameterType = parameter.getType();
      buf.append(parameterType.getName());

      if (parameters.hasNext()) {
        buf.append(',');
      }
    }
View Full Code Here

    Checker.notNull("parameter:type", type);

    final GeneratorContext context = this.getGeneratorContext();
    context.info("Verifying " + type + " is a bean factory.");

    final Type beanFactory = this.getBeanFactoryType();
    if (false == type.isAssignableTo(beanFactory)) {
      throwNotABeanFactory("The type \"" + type + "\" is not a " + beanFactory);
    }

    // verify has no public methods (ignore those belonging to
View Full Code Here

      throwBeanIdIsMissing(bean);
    }
    this.checkIdIsUnique(bean);

    final String className = bean.getTypeName();
    final Type beanType = this.getConcreteType(beanName, className);
    bean.setType(beanType);

    context.debug(beanType.getName());

    final boolean singleton = bean.isSingleton();
    bean.setSingleton(singleton);
    context.debug(singleton ? "singleton" : "prototype");

    // process the eager/lazy attribute
    final boolean eager = bean.isEagerLoaded();
    bean.setEagerLoaded(eager);
    this.checkPrototypesAreNotMarkedAsEager(bean);

    if (singleton) {
      context.debug(eager ? "eager" : "lazyloaded");
    }

    if (false == singleton) {
      final String destroyMethod = bean.getDestroyMethod();
      if (false == Tester.isNullOrEmpty(destroyMethod)) {
        throwPrototypeCantBeContainerDestroyed(bean);
      }

      final Type disposableBean = this.getDisposableBean();
      if (beanType.isAssignableTo(disposableBean)) {
        context.warn("Ignoring the fact the bean implements DisposableBean (because its a prototype)"
            + (context.isDebugEnabled() ? "." : ", bean: " + bean));
      }
    }

    // start creating the factory bean...
    final Type superType = singleton ? this.getSingletonFactoryBean() : this.getPrototypeFactoryBean();
    final NewConcreteType beanFactory = this.getBeanFactory();
    final NewNestedType factoryBean = beanFactory.newNestedType();
    factoryBean.setStatic(false);
    factoryBean.setNestedName(this.escapeBeanIdToBeClassNameSafe(beanName) + Constants.FACTORY_BEAN_SUFFIX);
    factoryBean.setSuperType(superType);
View Full Code Here

    Checker.notNull("parameter:bean", rpc);

    final NewType factoryBean = rpc.getFactoryBean();

    // get the actual interface type from the async interface type.
    final Type asyncInterfaceType = rpc.getType();
    final String asyncInterfaceName = asyncInterfaceType.getName();

    final String interfaceTypeName = asyncInterfaceName.substring(0, asyncInterfaceName.length() - Constants.ASYNC_SUFFIX.length());
    final Type interfaceType = this.getInterfaceType(rpc.getId(), interfaceTypeName);

    final NewMethod createInstance = this.createCreateInstanceMethod(factoryBean);
    final DeferredBinding body = new DeferredBinding();
    body.setType(interfaceType);
    createInstance.setBody(body);
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.