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

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

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

origin: sundrio/sundrio

public static Set<String> getKeywords(Collection<TypeDef> types) {
  Set<String> result = new HashSet<String>();
  for (TypeDef type : types) {
    Set<String> keywords = (Set<String>) type.getAttributes().get(KEYWORDS);
    if (keywords != null) {
      result.addAll(keywords);
    }
  }
  return result;
}
origin: sundrio/sundrio

  public Set<String> scopeKeywords(Collection<TypeDef> clazzes) {
    Set<String> result = new LinkedHashSet<String>();
    for (TypeDef clazz : clazzes) {
      Set<String> keywords = (Set<String>) clazz.getAttributes().get(KEYWORDS);
      result.addAll(keywords != null ? keywords : Collections.<String>emptySet());
    }
    return result;
  }
};
origin: sundrio/sundrio

public static Set<String> getClasses(Collection<TypeDef> types) {
  Set<String> result = new HashSet<String>();
  for (TypeDef type : types) {
    Set<String> classes = (Set<String>) type.getAttributes().get(CLASSES);
    if (classes != null) {
      result.addAll(classes);
    }
  }
  return result;
}
origin: sundrio/sundrio

public static Set<String> getMethods(Collection<TypeDef> types) {
  Set<String> result = new HashSet<String>();
  for (TypeDef type : types) {
    Set<String> methods = (Set<String>) type.getAttributes().get(METHODS);
    if (methods != null) {
      result.addAll(methods);
    }
  }
  return result;
}
origin: sundrio/sundrio

  public static LinkedList<String> getScopes(Collection<TypeDef> types) {
    Stack<String> stack = new Stack<String>();
    for (TypeDef type : types) {

      String scope = (String) type.getAttributes().get(BEGIN_SCOPE);
      if (scope != null && !scope.isEmpty()) {
        stack.push(scope);
      }

      scope = (String) type.getAttributes().get(END_SCOPE);
      if (scope != null && !scope.isEmpty()) {
        try {
          String found = stack.pop();
          if (!scope.equals(found)) {
            throw new IllegalStateException("End of scope:" + scope + " but active scope was:" + found);
          }
        } catch (EmptyStackException e) {
          throw new IllegalStateException("Expected active scope:" + scope + " but not was active.", e);
        }
      }
    }
    return new LinkedList<String>(stack);
  }
}
origin: sundrio/sundrio

public static boolean isSatisfied(TypeDef candidate, List<TypeDef> path) {
  Set<String> keywordsAndScopes = new LinkedHashSet<String>();
  Set<String> visitedKeywords = getKeywords(path);
  Deque<String> activeScopes = getScopes(path);
  keywordsAndScopes.addAll(visitedKeywords);
  keywordsAndScopes.addAll(activeScopes);
  TransitionFilter filter = (TransitionFilter) candidate.getAttributes().get(FILTER);
  Boolean multiple = (Boolean) candidate.getAttributes().get(CARDINALITY_MULTIPLE);
  Set<String> keywords = (Set<String>) candidate.getAttributes().get(KEYWORDS);
  if (!activeScopes.isEmpty() && !keywords.contains(activeScopes.getLast())) {
    return false;
  }
  int lastIndex = path.lastIndexOf(candidate);
  if (!multiple && path.contains(candidate)) {
    //Eliminate circles if not explicitly specified
    return false;
  } else if (multiple && lastIndex > 0 && lastIndex < path.size() - 1) {
    //We only accept repetition of the last element. Other wise we can end up in infinite loops
    return false;
  }
  return filter.apply(path);
}
origin: sundrio/sundrio

/**
 * Creates a {@link ClassRef} for the current definition with the specified arguments.
 *
 * @param arguments The arguments to be passed to the reference.
 */
public ClassRef toReference(List<TypeRef> arguments) {
  List<TypeRef> actualArguments = new ArrayList<TypeRef>();
  for (int i = 0; i < parameters.size(); i++) {
    if (i < arguments.size()) {
      actualArguments.add(arguments.get(i));
    } else {
      actualArguments.add(new WildcardRef());
    }
  }
  return new ClassRefBuilder()
      .withDefinition(this)
      .withArguments(actualArguments)
      .withAttributes(getAttributes())
      .build();
}
origin: sundrio/sundrio

if (getAttributes().containsKey(ALSO_IMPORT)) {
  Object obj = getAttributes().get(ALSO_IMPORT);
  if (obj instanceof ClassRef) {
    refs.add((ClassRef) obj);
origin: sundrio/sundrio

/**
 * Creates a {@link ClassRef} for the current definition with the specified arguments.
 *
 * @param arguments The arguments to be passed to the reference.
 */
public ClassRef toReference(TypeRef... arguments) {
  List<TypeRef> actualArguments = new ArrayList<TypeRef>();
  for (int i = 0; i < parameters.size(); i++) {
    if (i < arguments.length) {
      actualArguments.add(arguments[i]);
    } else {
      actualArguments.add(new WildcardRef());
    }
  }
  return new ClassRefBuilder()
      .withDefinition(this)
      .withArguments(actualArguments)
      .withAttributes(getAttributes())
      .build();
}
origin: sundrio/sundrio

/**
 * Creates a {@link ClassRef} for internal use inside the scope of the type (methods, properties
 * etc). It uses as arguments the same 'letters' as the parameters definition.
 */
public ClassRef toInternalReference() {
  List<TypeRef> arguments = new ArrayList<TypeRef>();
  for (TypeParamDef parameter : parameters) {
    arguments.add(parameter.toReference());
  }
  return new ClassRefBuilder()
      .withDefinition(this)
      .withArguments(arguments)
      .withAttributes(getAttributes())
      .build();
}
origin: sundrio/sundrio

if (typeDef.getAttributes().containsKey(EDIATABLE_ENABLED) && (Boolean) typeDef.getAttributes().get(EDIATABLE_ENABLED)) {
  generateFromResources(ClazzAs.EDITABLE_BUILDER.apply(typeDef),
      Constants.DEFAULT_SOURCEFILE_TEMPLATE_LOCATION);
origin: sundrio/sundrio

                    .withAnnotations(annotationRefs)
                    .addToAnnotations(inheritedPojoRef)
                    .withAttributes(item.getAttributes())
                    .build());
.withImplementsList(implementsList)
.withExtendsList(extendsList)
.addToAttributes(item.getAttributes())
.build();
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.modelTypeDefgetAttributes

Popular methods of TypeDef

  • getFullyQualifiedName
    Returns the fully qualified name of the type.
  • getName
  • getPackageName
  • equals
  • getConstructors
  • getExtendsList
  • getMethods
  • 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

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
  • setContentView (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JComboBox (javax.swing)
  • Top Vim 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