Java 类javax.lang.model.element.Parameterizable 实例源码

项目:GitHub    文件:AccessorAttributesCollector.java   
void collect() {
  collectGeneratedCandidateMethods(getTypeElement());

  Instantiator encodingInstantiator = protoclass.encodingInstantiator();
  @Nullable InstantiationCreator instantiationCreator =
      encodingInstantiator.creatorFor((Parameterizable) type.element);

  for (ValueAttribute attribute : attributes) {
    attribute.initAndValidate(instantiationCreator);
  }

  if (instantiationCreator != null) {
    type.additionalImports(instantiationCreator.imports);
  }

  type.attributes.addAll(attributes);
  type.accessorMapping = accessorMapping;
}
项目:javaide    文件:PrintingProcessor.java   
private void printFormalTypeParameters(Parameterizable e,
                                       boolean pad) {
    List<? extends TypeParameterElement> typeParams = e.getTypeParameters();
    if (typeParams.size() > 0) {
        writer.print("<");

        boolean first = true;
        for(TypeParameterElement tpe: typeParams) {
            if (!first)
                writer.print(", ");
            printAnnotationsInline(tpe);
            writer.print(tpe.toString());
            first = false;
        }

        writer.print(">");
        if (pad)
            writer.print(" ");
    }
}
项目:immutables    文件:AccessorAttributesCollector.java   
void collect() {
  collectGeneratedCandidateMethods(getTypeElement());

  Instantiator encodingInstantiator = protoclass.encodingInstantiator();
  @Nullable InstantiationCreator instantiationCreator =
      encodingInstantiator.creatorFor((Parameterizable) type.element);

  for (ValueAttribute attribute : attributes) {
    attribute.initAndValidate(instantiationCreator);
  }

  if (instantiationCreator != null) {
    type.additionalImports(instantiationCreator.imports);
  }

  type.attributes.addAll(attributes);
  type.accessorMapping = accessorMapping;
}
项目:GitHub    文件:ValueType.java   
private TypeExtractor getTypeExtractor() {
  if (typeExtractor == null) {
    this.typeExtractor = new TypeExtractor(
        Proto.TYPE_FACTORY,
        (Parameterizable) element);
  }
  return typeExtractor;
}
项目:GitHub    文件:TypeExtractor.java   
private Type.Parameters initParameters(Parameterizable context) {
  Type.Parameters parameters = factory.parameters();

  for (TypeParameterElement p : context.getTypeParameters()) {
    String name = p.getSimpleName().toString();
    // <T extends Cls<T>>: when parsing bounds for T, T should be already defined for recursion
    Type.Parameters parameterForRecursion = parameters.recursive(name);
    List<Type.Defined> bounds = getBounds(parameterForRecursion, p);
    parameters = parameters.introduce(name, bounds);
  }

  return parameters;
}
项目:GitHub    文件:Encodings.java   
private List<String> getTypeParameterNames(Parameterizable element) {
  List<String> names = new ArrayList<>();
  for (TypeParameterElement p : element.getTypeParameters()) {
    names.add(p.getSimpleName().toString());
  }
  return names;
}
项目:error-prone    文件:IncompatibleArgumentType.java   
private static int findTypeArgInList(Parameterizable hasTypeParams, String typeArgName) {
  List<? extends TypeParameterElement> typeParameters = hasTypeParams.getTypeParameters();
  for (int i = 0; i < typeParameters.size(); i++) {
    if (typeParameters.get(i).getSimpleName().contentEquals(typeArgName)) {
      return i;
    }
  }
  return -1;
}
项目:immutables    文件:TypeExtractor.java   
private Type.Parameters initParameters(Parameterizable context) {
  Type.Parameters parameters = factory.parameters();

  for (TypeParameterElement p : context.getTypeParameters()) {
    String name = p.getSimpleName().toString();
    // <T extends Cls<T>>: when parsing bounds for T, T should be already defined for recursion
    Type.Parameters parameterForRecursion = parameters.recursive(name);
    List<Type.Defined> bounds = getBounds(parameterForRecursion, p);
    parameters = parameters.introduce(name, bounds);
  }

  return parameters;
}
项目:immutables    文件:Encodings.java   
private List<String> getTypeParameterNames(Parameterizable element) {
  List<String> names = new ArrayList<>();
  for (TypeParameterElement p : element.getTypeParameters()) {
    names.add(p.getSimpleName().toString());
  }
  return names;
}
项目:GitHub    文件:TypeExtractor.java   
public TypeExtractor(Type.Factory factory, Parameterizable context) {
  this.factory = factory;
  this.parameters = initParameters(context);
  this.parser = new Type.Parser(factory, parameters);
}
项目:GitHub    文件:Instantiator.java   
public @Nullable InstantiationCreator creatorFor(Parameterizable element) {
  return !isEmpty() ? new InstantiationCreator(element) : null;
}
项目:GitHub    文件:Instantiator.java   
InstantiationCreator(Parameterizable parameterizable) {
  this.typeExtractor = new TypeExtractor(typeFactory, parameterizable);
}
项目:immutables    文件:TypeExtractor.java   
public TypeExtractor(Type.Factory factory, Parameterizable context) {
  this.factory = factory;
  this.parameters = initParameters(context);
  this.parser = new Type.Parser(factory, parameters);
}
项目:immutables    文件:Instantiator.java   
public @Nullable InstantiationCreator creatorFor(Parameterizable element) {
  return !isEmpty() ? new InstantiationCreator(element) : null;
}
项目:immutables    文件:Instantiator.java   
InstantiationCreator(Parameterizable parameterizable) {
  this.typeExtractor = new TypeExtractor(typeFactory, parameterizable);
}