Package rocket.generator.rebind.type

Examples of rocket.generator.rebind.type.Type


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

    Map<Type, Match> matches = null;

    while (true) {
      final Type type = this.getTypeFromAnnotation(readerOrWriter);
      if (null == type) {
        matches = Collections.<Type,Match>emptyMap();
        break;
      }
      if (false == this.shouldBeSerialized(type)) {
        matches = Collections.<Type,Match>emptyMap();
        break;
      }

      // interface find all implementing interfaces...
      if (type.isInterface()) {
        matches = this.findTypesImplementingInterface(type, readerOrWriter);
        break;
      }
      // find all sub classes...
      matches = new HashMap<Type, Match>();
View Full Code Here


   * @return The located type if an annotation exists on the incoming type.
   */
  protected Type getTypeFromAnnotation(final Type type) {
    Checker.notNull("parameter:type", type);

    Type typeFromAnnotation = null;
    while (true) {
      // annotation not found...
      final List<String> values = type.getMetadataValues(SerializationConstants.SERIALIZABLE_TYPE);
      if (values.size() == 0) {
        break;
View Full Code Here

  protected boolean findSingleMatch(final Map<Type,Match> matches, final Set<Type> serializableTypes) {
    boolean found = false;

    final Iterator<Type> iterator = matches.keySet().iterator();
    while (iterator.hasNext()) {
      final Type type = iterator.next();
      if (serializableTypes.contains(type)) {
        found = true;
        break;
      }
    }
View Full Code Here

    // need to check if any of the types in $newMatch exist in $oldMatches

    final Iterator<Map.Entry<Type, Match>> newMatchesIterator = newMatches.entrySet().iterator();
    while (newMatchesIterator.hasNext()) {
      final Map.Entry<Type, Match> entry = newMatchesIterator.next();
      final Type newType = entry.getKey();
      final Match newMatch = entry.getValue();

      List<Match> listOfMatchesForType = (List<Match>) oldMatches.get(newType);
      if (null == listOfMatchesForType) {
        listOfMatchesForType = new ArrayList<Match>();

        oldMatches.put(newType, listOfMatchesForType);
      }
      // only add if newMatch is not the same type as one of oldMatch's
      final Type newMatchReaderOrWriter = newMatch.getReaderWriter();
      final Iterator<Match> iterator = listOfMatchesForType.iterator();
      boolean duplicate = false;
      while (iterator.hasNext()) {
        final Match otherMatch = iterator.next();
        if (newMatchReaderOrWriter.equals(otherMatch.getReaderWriter())) {
          duplicate = true;
          break;
        }
      }
View Full Code Here

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

    final Iterator<Map.Entry<Type, List<Match>>> entries = matches.entrySet().iterator();
    while (entries.hasNext()) {
      final Map.Entry<Type, List<Match>> entry = entries.next();
      final Type type = entry.getKey();
      final List<Match> matchList = entry.getValue();

      // sort $matchList so the highest score appears first...
      Collections.sort(matchList, ObjectReaderOrWriterFinder.DESCENDING_SCORE_COMPARATOR);

      Match match = (Match) matchList.get(0);
      Type readerWriter = match.getReaderWriter();

      if (matchList.size() > 1) {
        final Match secondMatch = (Match) matchList.get(1);

        final int firstScore = match.getScore();
View Full Code Here

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

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

    CodeBlock literal = null;

    while (true) {
      final Type type = this.getPropertyType();
      final GeneratorContext context = this.getGeneratorContext();
      if (type == context.getBoolean()) {
        literal = new BooleanLiteral(this.getBooleanValue());
        break;
      }
View Full Code Here

   *         definition.
   */
  public Type getValueType() {
    // if bean type is a factoryBean read get the bean's actual delivered
    // type from the annotation.
    final Type type = this.getType();
    Type valueType = type;

    final GeneratorContext context = type.getGeneratorContext();
    final Type factoryBean = context.getType(Constants.FACTORY_BEAN);

    if (type.isAssignableTo(factoryBean)) {
      // locate the annotation and get the type from there...
      final List<String> factoryBeanObjectTypes = type.getMetadataValues(Constants.FACTORY_BEAN_OBJECT_TYPE);
      if (null == factoryBeanObjectTypes || factoryBeanObjectTypes.size() != 1) {
View Full Code Here

    if (false == parameters.isEmpty()) {
      throwInterfaceMethodHasParameters(method);
    }

    // must return Image.
    final Type type = method.getReturnType();
    final Type image = this.getImage();
    final Type gwtImage = this.getGwtImage();
    if (false == type.equals(image) && false == type.equals(gwtImage)) {
      this.throwWrongReturnType(method);
    }
  }
View Full Code Here

    final NewConcreteType newType = context.newConcreteType(newTypeName);
    newType.setAbstract(false);
    newType.setFinal(true);

    final Type superType = this.getImageFactoryImpl();
    newType.setSuperType(superType);

    newType.addInterface(type);

    newType.setVisibility(Visibility.PUBLIC);

    context.debug("extends " + superType.getName());
    context.debug("implements: " + type.getName());
    context.debug("public");
    context.debug("final");

    context.unbranch();
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.