You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ConnectorInitVisitor.java 1.0KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.widgetsetutils.metadata;
  5. import com.google.gwt.core.ext.typeinfo.JClassType;
  6. import com.google.gwt.core.ext.typeinfo.NotFoundException;
  7. import com.google.gwt.core.ext.typeinfo.TypeOracle;
  8. import com.vaadin.shared.ui.Connect;
  9. import com.vaadin.terminal.gwt.client.ServerConnector;
  10. public class ConnectorInitVisitor implements TypeVisitor {
  11. private JClassType serverConnector;
  12. @Override
  13. public void init(TypeOracle oracle) throws NotFoundException {
  14. serverConnector = oracle.getType(ServerConnector.class.getName());
  15. }
  16. @Override
  17. public void visit(JClassType type, ConnectorBundle bundle) {
  18. Connect connectAnnotation = type.getAnnotation(Connect.class);
  19. if (connectAnnotation != null && serverConnector.isAssignableFrom(type)) {
  20. bundle.setIdentifier(type, connectAnnotation.value()
  21. .getCanonicalName());
  22. bundle.setNeedsGwtConstructor(type);
  23. }
  24. }
  25. }