Package rocket.generator.rebind.visitor

Examples of rocket.generator.rebind.visitor.ConcreteTypesImplementingInterfaceVisitor


  public Map<Type, Type> build(final Set<Type> types) {
    Checker.notNull("parameter:types", types);

    final Map<Type, List<Match>> accumulator = new HashMap<Type, List<Match>>();

    final ConcreteTypesImplementingInterfaceVisitor visitor = new ConcreteTypesImplementingInterfaceVisitor() {

      @Override
      protected boolean visit(final Type readerOrWriter) {
        final Map<Type, Match> matches = ObjectReaderOrWriterFinder.this.findMatchingType(readerOrWriter);
        while (true) {
          // nothing to do...
          if (matches.isEmpty()) {
            break;
          }
          // check if any of the matched types overlap any of the
          // serializedtypes.. if result is none do nothing...
          if (false == ObjectReaderOrWriterFinder.this.findSingleMatch(matches, types)) {
            break;
          }

          ObjectReaderOrWriterFinder.this.mergeMatches(matches, accumulator);
          break;
        }
        return false;
      }

      @Override
      protected boolean skipAbstractTypes() {
        return true;
      }
    };
    final Type readerOrWriterInterface = this.getImplementingInterface();
    visitor.start(readerOrWriterInterface);

    return this.finalizeBindings(accumulator);
  }
View Full Code Here


    Checker.notNull("parameter:interfacee", interfacee);
    Checker.notNull("parameter:readerOrWriter", readerOrWriter);

    final Map<Type, Match> matches = new HashMap<Type, Match>();

    final ConcreteTypesImplementingInterfaceVisitor visitor = new ConcreteTypesImplementingInterfaceVisitor() {

      @Override
      protected boolean skip(final Type interfacee, final Type type) {
        boolean skip = super.skip(interfacee, type);

        if (false == skip) {
          skip = !ObjectReaderOrWriterFinder.this.shouldBeSerialized(type);
        }

        return skip;
      }

      @Override
      protected boolean visit(final Type type) {
        final boolean previouslyVisited = matches.containsKey(type);
        if (false == previouslyVisited) {
          matches.put(type, new Match(readerOrWriter, ObjectReaderOrWriterFinder.INTERFACE_MATCH));
        }
        return previouslyVisited;
      }

      protected boolean skipAbstractTypes() {
        return false;
      }
    };
    visitor.start(interfacee);
    return matches;
  }
View Full Code Here

TOP

Related Classes of rocket.generator.rebind.visitor.ConcreteTypesImplementingInterfaceVisitor

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.