com.google.gwt.core.ext.typeinfo.NotFoundException Java Examples

The following examples show how to use com.google.gwt.core.ext.typeinfo.NotFoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceBinderCreator.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
public String create(TreeLogger logger, GeneratorContext context) throws UnableToCompleteException, NotFoundException {
	PrintWriter printWriter = this.getPrintWriter(logger, context);
	if (printWriter == null) {
		return this.proxyModelQualifiedName;
	}

	this.serializerTypeName = this.createSerializer(logger, context);
	this.collectImports();

	SourceWriter srcWriter = this.getSourceWriter(printWriter, context);

	srcWriter.indent();
	srcWriter.println();
	this.generateSerializer(srcWriter);
	srcWriter.println();
	this.generateServiceImplementation(logger, srcWriter);
	this.generateServiceImplementationWithCallback(logger, srcWriter);

	srcWriter.outdent();
	srcWriter.commit(logger);
	return this.proxyModelQualifiedName;
}
 
Example #2
Source File: EventBinderGenerator.java    From gwteventbinder with Apache License 2.0 6 votes vote down vote up
@Override
public String generate(TreeLogger logger, GeneratorContext context,
    String typeName) throws UnableToCompleteException {
  try {
    JClassType eventBinderType = context.getTypeOracle().getType(typeName);
    JClassType targetType = getTargetType(eventBinderType, context.getTypeOracle());
    SourceWriter writer = createSourceWriter(logger, context, eventBinderType, targetType);
    if (writer != null) { // Otherwise the class was already created
      new EventBinderWriter(
          logger,
          context.getTypeOracle().getType(GenericEvent.class.getCanonicalName()))
              .writeDoBindEventHandlers(targetType, writer, context.getTypeOracle());
      writer.commit(logger);
    }
    return getFullyQualifiedGeneratedClassName(eventBinderType);
  } catch (NotFoundException e) {
    logger.log(Type.ERROR, "Error generating " + typeName, e);
    throw new UnableToCompleteException();
  }
}
 
Example #3
Source File: StubClassType.java    From mvp4g with Apache License 2.0 5 votes vote down vote up
@Override
public JMethod getMethod(String name,
                         JType[] paramTypes)
  throws NotFoundException {

  return null;
}
 
Example #4
Source File: InjectorModuleCreator.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void doCreate(TreeLogger logger, GeneratorContext context, SourceWriter srcWriter) {
	super.doCreate(logger, context, srcWriter);

	srcWriter.println("@Override public void onModuleLoad() {");
	srcWriter.indent();

	try {
		if (this.injectableType.getMethod("onModuleLoad", new JType[] {}) != null) {
			srcWriter.println("super.onModuleLoad();");
		}
	} catch (NotFoundException e) {
		srcWriter.println("");
	}

	for (InjectorWritterEntryPoint delegate : Iterables.filter(this.delegates, InjectorWritterEntryPoint.class)) {
		delegate.writeEntryPoint(srcWriter);
		srcWriter.println();
	}

	for (JMethod method : InjectCreatorUtil.listMethod(this.injectableType, EntryPointHandler.class)) {
		srcWriter.println("super.%s();", method.getName());
	}

	srcWriter.println();
	MvpDescription mvpAnnotation = this.injectableType.getAnnotation(MvpDescription.class);
	if (mvpAnnotation != null && mvpAnnotation.handleCurrentHistory()) {
		srcWriter.println("MvpController.get().handleCurrentHistory();");
	}
	srcWriter.outdent();
	srcWriter.println("}");
}
 
Example #5
Source File: JacksonTypeOracle.java    From gwt-jackson with Apache License 2.0 5 votes vote down vote up
/**
 * <p>getType</p>
 *
 * @param type a {@link java.lang.String} object.
 * @return a {@link com.google.gwt.core.ext.typeinfo.JClassType} object.
 * @throws com.google.gwt.core.ext.UnableToCompleteException if any.
 */
public JClassType getType( String type ) throws UnableToCompleteException {
    try {
        return typeOracle.getType( type );
    } catch ( NotFoundException e ) {
        logger.log( TreeLogger.ERROR, "TypeOracle could not find " + type );
        throw new UnableToCompleteException();
    }
}
 
Example #6
Source File: StubClassType.java    From mvp4g with Apache License 2.0 4 votes vote down vote up
@Override
public JConstructor getConstructor(JType[] paramTypes)
  throws NotFoundException {

  return null;
}
 
Example #7
Source File: StubClassType.java    From mvp4g with Apache License 2.0 4 votes vote down vote up
@Override
public JClassType getNestedType(String typeName)
  throws NotFoundException {

  return null;
}
 
Example #8
Source File: ImageSpriteCreator.java    From gss.gwt with Apache License 2.0 4 votes vote down vote up
private void createSprite(CssDeclarationNode declaration) {
  List<CssValueNode> valuesNodes = declaration.getPropertyValue().getChildren();

  if (valuesNodes.size() != 1) {
    errorManager.report(new GssError(SPRITE_PROPERTY_NAME + " must have exactly one value",
        declaration.getSourceCodeLocation()));
  }

  String imageResource = valuesNodes.get(0).getValue();

  JMethod imageMethod;
  try {
    imageMethod = ResourceGeneratorUtil.getMethodByPath(context.getClientBundleType(),
        getPathElement(imageResource), imageResourceType);
  } catch (NotFoundException e) {
    errorManager.report(new GssError("Unable to find ImageResource method "
        + imageResource + " in " + context.getClientBundleType().getQualifiedSourceName() + " : "
        + e.getMessage(), declaration.getSourceCodeLocation()));
    return;
  }

  ImageOptions options = imageMethod.getAnnotation(ImageOptions.class);
  RepeatStyle repeatStyle = options != null ? options.repeatStyle() : RepeatStyle.None;

  Builder<CssDeclarationNode> listBuilder = ImmutableList.builder();
  SourceCodeLocation sourceCodeLocation = declaration.getSourceCodeLocation();

  String repeatText;
  switch (repeatStyle) {
    case None:
      repeatText = " no-repeat";
      listBuilder.add(buildHeightDeclaration(imageResource, sourceCodeLocation));
      listBuilder.add(buildWidthDeclaration(imageResource, sourceCodeLocation));
      break;
    case Horizontal:
      repeatText = " repeat-x";
      listBuilder.add(buildHeightDeclaration(imageResource, sourceCodeLocation));
      break;
    case Vertical:
      repeatText = " repeat-y";
      listBuilder.add(buildWidthDeclaration(imageResource, sourceCodeLocation));
      break;
    case Both:
      repeatText = " repeat";
      break;
    default:
      errorManager.report(new GssError("Unknown repeatStyle " + repeatStyle,
          sourceCodeLocation));
      return;
  }

  listBuilder.add(buildOverflowDeclaration(sourceCodeLocation));
  listBuilder.add(buildBackgroundDeclaration(imageResource, repeatText, sourceCodeLocation));

  visitController.replaceCurrentBlockChildWith(listBuilder.build(), false);
}