Tabnine Logo
TypeDef.toInternalReference
Code IndexAdd Tabnine to your IDE (free)

How to use
toInternalReference
method
in
io.sundr.codegen.model.TypeDef

Best Java code snippets using io.sundr.codegen.model.TypeDef.toInternalReference (Showing top 20 results out of 315)

origin: sundrio/sundrio

  public void visit(ClassRefBuilder builder) {
    List<TypeRef> updatedArguments = new ArrayList<TypeRef>();
    for (TypeRef arg : builder.getArguments()) {
      if (arg.equals(builderType.toInternalReference())) {
        updatedArguments.add(shallowInlineType.toInternalReference());
      } else {
        updatedArguments.add(arg);
      }
    }
    builder.withArguments(updatedArguments);
  }
}).build();
origin: sundrio/sundrio

public static Set<ClassRef> extractInterfacesFromType(TypeDef type) {
  Set<ClassRef> result = new LinkedHashSet<ClassRef>();
  if (type.getExtendsList().isEmpty()) {
    result.add(type.toInternalReference());
  } else {
    for (ClassRef interfaceType : type.getExtendsList()) {
      result.addAll(extractInterfacesFromClassRef(interfaceType));
    }
  }
  return result;
}
origin: sundrio/sundrio

private Map<String, String> getReferenceMapInternal() {
  Map<String, String> mapping = new HashMap<String, String>();
  List<ClassRef> refs = new ArrayList<ClassRef>();
  for (TypeDef typeDef : getDefinitions()) {
    refs.add(typeDef.toInternalReference());
  }
  //It's best to have predictable order, so that we can generate uniform code.
  Collections.sort(refs, new Comparator<ClassRef>() {
    @Override
    public int compare(ClassRef o1, ClassRef o2) {
      return o1.getFullyQualifiedName().compareTo(o2.getFullyQualifiedName());
    }
  });
  for (ClassRef classRef : refs) {
    String key = classRef.getDefinition().getName();
    if (!mapping.containsKey(key)) {
      mapping.put(key, classRef.getDefinition().getFullyQualifiedName());
    }
  }
  mapping.putAll(custom);
  return mapping;
}
origin: sundrio/sundrio

for (TypeDef alternative : alternatives) {
  if (!canBeExcluded(alternative, alternatives)) {
    interfaces.add(alternative.toInternalReference());
    terminatingTypes.addAll(getTerminatingTypes(alternative));
  interfaces.add(fallback.toInternalReference());
  terminatingTypes.addAll(getTerminatingTypes(fallback));
  for (TypeParamDef candidate : extractParameters(fallback)) {
origin: sundrio/sundrio

  public TypeDef apply(TypeDef item) {
    TypeDef builder = SHALLOW_BUILDER.apply(item);
    TypeDef fluent = FLUENT_IMPL.apply(item);
    List<TypeRef> parameters = new ArrayList<TypeRef>();
    for (TypeParamDef param : item.getParameters()) {
      parameters.add(param.toReference());
    }
    parameters.add(builder.toInternalReference());
    return new TypeDefBuilder(item)
        .withKind(Kind.CLASS)
        .withModifiers(TypeUtils.modifiersToInt(Modifier.PUBLIC))
        .withName(item.getName() + "Builder")
        .withParameters(item.getParameters())
        .withInnerTypes()
        .withExtendsList(fluent.toReference(parameters))
        .withImplementsList(BuilderContextManager.getContext().getVisitableBuilderInterface().toReference(item.toInternalReference(), builder.toInternalReference()))
        .build();
  }
};
origin: sundrio/sundrio

public ClassRef apply(Node<TypeDef> current) {
  if (current.getTransitions().isEmpty()) {
    return current.getItem().toInternalReference();
  } else {
    TypeDef clazz = current.getItem();
        : Combine.TYPEREFS.apply(Generify.CLASSREFS.apply(toCombine)).toInternalReference();
      toReCombine.add(selfRef);
      TypeDef reCombinedType = Combine.TYPEREFS.apply(toReCombine);
      final ClassRef reCombinedRef = reCombinedType.toInternalReference();
      ClassRef reCombined = reCombinedType.toInternalReference();
      reCombined = Combine.TYPEREFS.apply(toReCombine).toInternalReference();
      DslContextManager.getContext().getDefinitionRepository().register(reCombinedType, IS_GENERATED);
      DslContextManager.getContext().getDefinitionRepository().register(nextClazz.getDefinition(), IS_GENERATED);
origin: sundrio/sundrio

public static ClassRef buildableRef(TypeRef typeRef) {
  ClassRef unwrapped = (ClassRef) TypeAs.combine(UNWRAP_COLLECTION_OF, UNWRAP_ARRAY_OF, UNWRAP_OPTIONAL_OF).apply(typeRef);
  return isAbstract(unwrapped) || unwrapped.getDefinition().getKind() == Kind.INTERFACE ? TypeAs.VISITABLE_BUILDER.apply(unwrapped) : TypeAs.BUILDER.apply(unwrapped.getDefinition()).toInternalReference();
}
origin: sundrio/sundrio

  public TypeDef apply(TypeDef item) {
    List<TypeParamDef> parameters = new ArrayList<TypeParamDef>();
    for (TypeParamDef generic : item.getParameters()) {
      parameters.add(generic);
    }
    return new TypeDefBuilder(item)
        .withKind(Kind.CLASS)
        .withModifiers(TypeUtils.modifiersToInt(Modifier.PUBLIC))
        .withName("Editable" + item.getName())
        .withParameters(parameters)
        .withExtendsList(item.toInternalReference())
        .withImplementsList(BuilderContextManager.getContext().getEditableInterface().toReference(SHALLOW_BUILDER.apply(item).toInternalReference()))
        .withInnerTypes()
        .withProperties()
        .withMethods()
        .withConstructors()
        .build();
  }
};
origin: sundrio/sundrio

if (returnType instanceof ClassRef) {
  TypeDef toUnwrap = ((ClassRef)returnType).getDefinition();
  methods.add(new MethodBuilder(m).withReturnType(Generics.UNWRAP.apply(toUnwrap).toInternalReference()).build());
} else if (returnType.getAttributes().containsKey(ORIGINAL_REF)) {
  methods.add(new MethodBuilder(m).withReturnType((TypeRef) returnType.getAttributes().get(ORIGINAL_REF)).build());
origin: sundrio/sundrio

public TypeDef apply(TypeDef item) {
  BuilderContext ctx = BuilderContextManager.getContext();
  TypeDef fluent = SHALLOW_FLUENT.apply(item);
  List<TypeParamDef> parameters = new ArrayList<TypeParamDef>(item.getParameters());
  List<TypeRef> superClassParameters = new ArrayList<TypeRef>();
  TypeParamDef nextParameter = getNextGeneric(item, parameters);
  ClassRef builableSuperClassRef = findBuildableSuperClassRef(item);
  if (builableSuperClassRef != null) {
    superClassParameters.addAll(builableSuperClassRef.getArguments());
  }
  TypeParamDef parameterFluent = new TypeParamDefBuilder(nextParameter).addToBounds(fluent.toInternalReference()).build();
  parameters.add(parameterFluent);
  superClassParameters.add(parameterFluent.toReference());
  TypeDef buildableSuperClass = findBuildableSuperClass(item);
  TypeDef superClass = buildableSuperClass != null
      ? FLUENT_IMPL.apply(buildableSuperClass)
      : ctx.getBaseFluentClass();
  return new TypeDefBuilder(item)
      .withKind(Kind.CLASS)
      .withModifiers(TypeUtils.modifiersToInt(Modifier.PUBLIC))
      .withName(item.getName() + "FluentImpl")
      .withPackageName(item.getPackageName())
      .withParameters(parameters)
      .withExtendsList(superClass.toReference(superClassParameters))
      .withImplementsList(SHALLOW_FLUENT.apply(item).toInternalReference())
      .withInnerTypes()
      .build();
}
origin: sundrio/sundrio

alsoImport.add(builder.toInternalReference());
origin: sundrio/sundrio

  public TypeDef apply(TypeDef item) {
    BuilderContext ctx = BuilderContextManager.getContext();
    TypeDef fluent = SHALLOW_FLUENT.apply(item);
    List<TypeParamDef> parameters = new ArrayList<TypeParamDef>(item.getParameters());
    List<TypeRef> superClassParameters = new ArrayList<TypeRef>();
    TypeParamDef nextParameter = getNextGeneric(item, parameters);
    ClassRef builableSuperClassRef = findBuildableSuperClassRef(item);
    TypeDef buildableSuperClass = findBuildableSuperClass(item);
    if (builableSuperClassRef != null) {
      superClassParameters.addAll(builableSuperClassRef.getArguments());
    }
    TypeParamDef parameterFluent = new TypeParamDefBuilder(nextParameter).addToBounds(fluent.toInternalReference()).build();
    parameters.add(parameterFluent);
    superClassParameters.add(parameterFluent.toReference());
    TypeDef superClass = buildableSuperClass != null
        ? SHALLOW_FLUENT.apply(buildableSuperClass)
        : ctx.getFluentInterface();
    return new TypeDefBuilder(item)
        .withKind(Kind.INTERFACE)
        .withModifiers(TypeUtils.modifiersToInt(Modifier.PUBLIC))
        .withName(item.getName() + "Fluent")
        .withPackageName(item.getPackageName())
        .withParameters(parameters)
        .withExtendsList(superClass.toReference(superClassParameters))
        .withImplementsList()
        .withInnerTypes()
        .build();
  }
};
origin: sundrio/sundrio

refs.add(typeDef.toInternalReference());
origin: sundrio/sundrio

.withReturnType(builderType.toInternalReference())
.withName("edit")
.withNewBlock()
origin: sundrio/sundrio

baseType = propertyTypeDef.toInternalReference();
origin: sundrio/sundrio

baseType = propertyTypeDef.toInternalReference();
origin: sundrio/sundrio

baseType = propertyTypeDef.toInternalReference();
origin: sundrio/sundrio

String ownPrefix = isCollection ? "addNew" : "withNew";
ownPrefix += BuilderUtils.fullyQualifiedNameDiff(baseType.toInternalReference(), originTypeDef);
String ownName = ownPrefix + (isCollection
    ? Singularize.FUNCTION.apply(property.getNameCapitalized())
origin: sundrio/sundrio

baseType = propertyTypeDef.toInternalReference();
origin: sundrio/sundrio

ClassRef unwrapped = (ClassRef) TypeAs.combine(UNWRAP_COLLECTION_OF, UNWRAP_ARRAY_OF, UNWRAP_OPTIONAL_OF).apply(typeRef);
ClassRef classRef = (ClassRef) typeRef;
ClassRef builderType = isAbstract(unwrapped) ||  unwrapped.getDefinition().getKind() == Kind.INTERFACE  ? TypeAs.VISITABLE_BUILDER.apply(unwrapped) : TypeAs.BUILDER.apply(unwrapped.getDefinition()).toInternalReference();
io.sundr.codegen.modelTypeDeftoInternalReference

Javadoc

Creates a ClassRef for internal use inside the scope of the type (methods, properties etc). It uses as arguments the same 'letters' as the parameters definition.

Popular methods of TypeDef

  • getFullyQualifiedName
    Returns the fully qualified name of the type.
  • getName
  • getPackageName
  • equals
  • getAttributes
  • getConstructors
  • getExtendsList
  • getMethods
  • getParameters
  • getProperties
  • toReference
  • getAnnotations
  • toReference,
  • getAnnotations,
  • getAttribute,
  • getImplementsList,
  • getKind,
  • hasAttribute,
  • isAbstract,
  • isAssignableFrom,
  • toUnboundedReference

Popular in Java

  • Making http post requests using okhttp
  • getSystemService (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • ImageIO (javax.imageio)
  • Join (org.hibernate.mapping)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now