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

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

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

origin: sundrio/sundrio

public static boolean has(TypeDef clazz, Property property) {
  for (Method method : clazz.getMethods()) {
    if (isApplicable(method, property)) {
      return true;
    }
  }
  return false;
}
origin: sundrio/sundrio

/**
 * Check if method exists on the specified type.
 * @param typeDef   The type.
 * @param method    The method name.
 * @return          True if method is found, false otherwise.
 */
public static boolean hasMethod(TypeDef typeDef, String method) {
  return unrollHierarchy(typeDef)
  .stream()
  .flatMap(h -> h.getMethods().stream())
  .filter(m -> method.equals(m.getName()))
  .findAny()
  .isPresent();
}
origin: sundrio/sundrio

private static boolean hasArrayFields(TypeDef item) {
  return item.getMethods()
      .stream()
      .filter(m -> m.getReturnType() instanceof ClassRef && ((ClassRef)m.getReturnType()).getDimensions() > 0)
      .findAny().isPresent();
}
origin: sundrio/sundrio

private static final Method getterOf(TypeDef source, Property property)  {
  Method result =  source.getMethods().stream()
      .filter(m -> m.isPublic() && m.getArguments().size() == 0 && Getter.propertyNameSafe(m).equals(property.getName()))
      .findFirst()
      .orElse(null);
  return result;
}
origin: sundrio/sundrio

public static Set<String> allGenericsOf(TypeDef clazz) {
  Set<String> result = new HashSet<String>();
  for (TypeParamDef paramDef : clazz.getParameters()) {
    result.add(paramDef.getName());
  }
  for (Property property : clazz.getProperties()) {
    result.addAll(allGenericsOf(property));
  }
  for (Method method : clazz.getMethods()) {
    result.addAll(allGenericsOf(method));
  }
  return result;
}
origin: sundrio/sundrio

  /**
   * Checks that a factory method with the required number of arguments is found.
   * @param arguments
   */
  private void checkFactoryMethodArguments(int arguments) {
    for (Method m : typeDef.getMethods()) {
      int a = m.getArguments() != null ? m.getArguments().size() : 0;
      if (m.getName().equals(staticFactoryMethod) && a == arguments && m.isStatic()) {
        return;
      }
    }
    throw new IllegalArgumentException("No static method found on " + typeDef.getName() + " with name " + staticFactoryMethod + " and " + arguments + " arguments.");
  }
}
origin: sundrio/sundrio

  public static boolean hasOrInherits(TypeDef clazz, Property property) {
    TypeDef current = clazz;
    //Iterate parent objects and check for properties with setters but not ctor arguments.
    while (current!= null && !current.equals(TypeDef.OBJECT)) {
      for (Method method : current.getMethods()) {
        if (isApplicable(method, property)) {
          return true;
        }
      }

      if (!current.getExtendsList().isEmpty()) {
        String fqn = current.getExtendsList().iterator().next().getDefinition().getFullyQualifiedName();
        current = DefinitionRepository.getRepository().getDefinition(fqn);
      } else {
        current = null;
      }
    }
    return false;
  }
}
origin: sundrio/sundrio

sb.append("return new ").append(pojoBuilder.getName()).append("()");
for (Method m : source.getMethods()) {
  String trimmedName = StringUtils.deCapitalizeFirst(m.getName().replaceAll("^get", "").replaceAll("^is", ""));
  if (m.getReturnType() instanceof ClassRef)  {
origin: sundrio/sundrio

/**
 * Checks if {@link ClassRef} is buildable.
 * @param ref       The reference.
 * @return          True if buildable repository contains the ref or builder for the reference is present.
 */
public static boolean isBuildable(ClassRef ref) {
  if (BuilderContextManager.getContext().getBuildableRepository().isBuildable(ref)) {
    return true;
  }
  String builderFQCN = ref.getDefinition().getFullyQualifiedName() + "Builder";
  TypeDef builder = BuilderContextManager.getContext().getDefinitionRepository().getDefinition(builderFQCN);
  if (builder == null) {
    return false;
  }
  return builder.getMethods()
      .stream()
      .filter(m -> "build".equals(m.getName()))
      .filter(m -> m.getReturnType().isAssignableFrom(ref))
      .count() > 0;
}
origin: sundrio/sundrio

while (current!= null && !current.equals(TypeDef.OBJECT)) {
  for (Method method : current.getMethods()) {
    if (isApplicable(method, property, true, false)) {
      return method;
  for (Method method : current.getMethods()) {
    if (isApplicable(method, property, false, false)) {
      return method;
    for (Method method : current.getMethods()) {
      if (isApplicable(method, property, false, true)) {
        return method;
origin: sundrio/sundrio

  public TypeDef apply(TypeDef... items) {
    if (items == null || items.length == 0) {
      throw new IllegalArgumentException("Items cannot be empty.");
    } else if (items.length == 1) {
      return items[0];
    } else if (items.length == 2) {
      TypeDef mergedType = TYPES.apply(new TypeDef[]{items[0], items[1]});
      TypeDefBuilder builder = new TypeDefBuilder(mergedType);
      for (Method constructor : items[1].getConstructors()) {
        builder = builder.addToConstructors(constructor);
      }
      for (Method method : items[1].getMethods()) {
        builder = builder.addToMethods(method);
      }
      for (Property property : items[1].getProperties()) {
        builder = builder.addToProperties(property);
      }
      return builder.build();
    } else {
      TypeDef[] rest = new TypeDef[items.length - 1];
      System.arraycopy(items, 1, rest, 0, rest.length);
      CLASSES.apply(new TypeDef[]{items[0], CLASSES.apply(rest)});
    }
    return null;
  }
};
origin: sundrio/sundrio

for (Method m : current.getMethods()) {
  TypeRef returnType = m.getReturnType();
  if (returnType instanceof ClassRef) {
for (Method m : current.getMethods()) {
  methods.add(new MethodBuilder(m).withReturnType(current.toUnboundedReference()).build());
origin: sundrio/sundrio

for (Method method : t.getMethods()) {
    for (Method method : superClass.getMethods()) {
        if (Getter.is(method)) {
            for (Method m : getters) {
item.getMethods()
    .stream()
    .filter(m -> m.getReturnType() instanceof ClassRef && ((ClassRef)m.getReturnType()).getDimensions() > 0)
origin: sundrio/sundrio

public TypeDefFluentImpl(TypeDef instance){
    this.withKind(instance.getKind()); 
    this.withPackageName(instance.getPackageName()); 
    this.withName(instance.getName()); 
    this.withComments(instance.getComments()); 
    this.withAnnotations(instance.getAnnotations()); 
    this.withExtendsList(instance.getExtendsList()); 
    this.withImplementsList(instance.getImplementsList()); 
    this.withParameters(instance.getParameters()); 
    this.withProperties(instance.getProperties()); 
    this.withConstructors(instance.getConstructors()); 
    this.withMethods(instance.getMethods()); 
    this.withOuterType(instance.getOuterType()); 
    this.withInnerTypes(instance.getInnerTypes()); 
    this.withModifiers(instance.getModifiers()); 
    this.withAttributes(instance.getAttributes()); 
}
origin: sundrio/sundrio

public TypeDefBuilder(TypeDef instance,Boolean validationEnabled){
    this.fluent = this; 
    this.withKind(instance.getKind()); 
    this.withPackageName(instance.getPackageName()); 
    this.withName(instance.getName()); 
    this.withComments(instance.getComments()); 
    this.withAnnotations(instance.getAnnotations()); 
    this.withExtendsList(instance.getExtendsList()); 
    this.withImplementsList(instance.getImplementsList()); 
    this.withParameters(instance.getParameters()); 
    this.withProperties(instance.getProperties()); 
    this.withConstructors(instance.getConstructors()); 
    this.withMethods(instance.getMethods()); 
    this.withOuterType(instance.getOuterType()); 
    this.withInnerTypes(instance.getInnerTypes()); 
    this.withModifiers(instance.getModifiers()); 
    this.withAttributes(instance.getAttributes()); 
    this.validationEnabled = validationEnabled; 
}
origin: sundrio/sundrio

public TypeDefBuilder(TypeDefFluent<?> fluent,TypeDef instance,Boolean validationEnabled){
    this.fluent = fluent; 
    fluent.withKind(instance.getKind()); 
    fluent.withPackageName(instance.getPackageName()); 
    fluent.withName(instance.getName()); 
    fluent.withComments(instance.getComments()); 
    fluent.withAnnotations(instance.getAnnotations()); 
    fluent.withExtendsList(instance.getExtendsList()); 
    fluent.withImplementsList(instance.getImplementsList()); 
    fluent.withParameters(instance.getParameters()); 
    fluent.withProperties(instance.getProperties()); 
    fluent.withConstructors(instance.getConstructors()); 
    fluent.withMethods(instance.getMethods()); 
    fluent.withOuterType(instance.getOuterType()); 
    fluent.withInnerTypes(instance.getInnerTypes()); 
    fluent.withModifiers(instance.getModifiers()); 
    fluent.withAttributes(instance.getAttributes()); 
    this.validationEnabled = validationEnabled; 
}
public TypeDefBuilder(TypeDef instance){
io.sundr.codegen.modelTypeDefgetMethods

Popular methods of TypeDef

  • getFullyQualifiedName
    Returns the fully qualified name of the type.
  • getName
  • getPackageName
  • equals
  • getAttributes
  • getConstructors
  • getExtendsList
  • getParameters
  • getProperties
  • toInternalReference
    Creates a ClassRef for internal use inside the scope of the type (methods, properties etc). It uses
  • toReference
  • getAnnotations
  • toReference,
  • getAnnotations,
  • getAttribute,
  • getImplementsList,
  • getKind,
  • hasAttribute,
  • isAbstract,
  • isAssignableFrom,
  • toUnboundedReference

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JTable (javax.swing)
  • Best IntelliJ plugins
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