Tabnine Logo
SType.isTypeOf
Code IndexAdd Tabnine to your IDE (free)

How to use
isTypeOf
method
in
org.opensingular.form.SType

Best Java code snippets using org.opensingular.form.SType.isTypeOf (Showing top 13 results out of 315)

origin: org.opensingular/singular-form-core

  /**
   * Checks if the instance is of the type informed or type derived of the informed type. See more in {@link
   * SType#isTypeOf(SType)}.
   */
  public boolean isTypeOf(@Nonnull SType<?> parentTypeCandidate) {
    return getType().isTypeOf(parentTypeCandidate);
  }
}
origin: org.opensingular/form-core

public final boolean isDependentType(SType<?> type) {
  if (dependentTypes != null) {
    for (SType<?> d : dependentTypes) {
      if (type.isTypeOf(d)) {
        return true;
      }
    }
  }
  return superType != null && superType.isDependentType(type);
}
origin: org.opensingular/singular-form-core

public final boolean isDependentType(SType<?> type) {
  if (dependentTypes != null) {
    for (SType<?> d : dependentTypes) {
      if (type.isTypeOf(d)) {
        return true;
      }
    }
  }
  return superType != null && superType.isDependentType(type);
}
origin: org.opensingular/singular-form-core

/** Finds the common parent type of the two types. */
@Nonnull
static final SType<?> findCommonType(@Nonnull SType<?> type1, @Nonnull SType<?> type2) {
  verifySameDictionary(type1, type2);
  for (SType<?> current = type1; ; current = current.getSuperType()) {
    if (type2.isTypeOf(current)) {
      return current;
    }
  }
}
origin: org.opensingular/form-core

/**
 * Retorna uma Stream que percorre os descendentes de <code>node</code> do tipo especificado.
 * @param root instância inicial da busca
 * @param descendantType tipo do descendente
 * @return Stream das instâncias de descendentes do tipo especificado
 */
@SuppressWarnings("unchecked")
public static <D extends SInstance> Stream<D> streamDescendants(SInstance root, boolean includeRoot, SType<D> descendantType) {
  return streamDescendants(root, includeRoot)
    .filter(it -> it.getType().isTypeOf(descendantType))
    .map(it -> (D) it);
}
origin: org.opensingular/form-core

/**
 * Lista os descendentes de <code>node</code> do tipo especificado.
 * @param instance instância inicial da busca
 * @param descendantType tipo do descendente
 * @return Lista das instâncias de descendentes do tipo especificado
 */
@SuppressWarnings("unchecked")
public static <D extends SInstance, V> List<V> listDescendants(SInstance instance, SType<?> descendantType, Function<D, V> function) {
  List<V> result = new ArrayList<>();
  final Deque<SInstance> deque = new ArrayDeque<>();
  deque.add(instance);
  while (!deque.isEmpty()) {
    final SInstance node = deque.removeFirst();
    if (node.getType().isTypeOf(descendantType)) {
      result.add(function.apply((D) node));
    } else {
      deque.addAll(children(node));
    }
  }
  return result;
}
origin: org.opensingular/form-core

/**
 * Busca pelo primeiro descendente de <code>node</code> do tipo especificado.
 * @param instance instância inicial da busca
 * @param descendantType tipo do descendente
 * @return Optional da instância do primeiro descendente do tipo especificado
 */
@SuppressWarnings("unchecked")
public static <D extends SInstance> Optional<D> findDescendant(SInstance instance, SType<D> descendantType) {
  final Deque<SInstance> deque = new ArrayDeque<>();
  deque.add(instance);
  while (!deque.isEmpty()) {
    final SInstance node = deque.removeFirst();
    if (node.getType().isTypeOf(descendantType)) {
      return Optional.of((D) node);
    } else {
      deque.addAll(children(node));
    }
  }
  return Optional.empty();
}
origin: org.opensingular/form-core

/**
 * Busca por um ancestral de <code>node</code> do tipo especificado.
 * @param node instância inicial da busca
 * @param ancestorType tipo do ancestral
 * @return Optional da instância do ancestral do tipo especificado
 */
@SuppressWarnings("unchecked")
public static <A extends SInstance & ICompositeInstance> Optional<A> findAncestor(SInstance node, SType<A> ancestorType) {
  for (SInstance parent = node.getParent(); parent != null; parent = parent.getParent()) {
    if (parent.getType().isTypeOf(ancestorType)) {
      return Optional.of((A) parent);
    }
  }
  return Optional.empty();
}
origin: org.opensingular/form-core

private boolean hasDirectOrInderectDependentType(SType<?> type) {
  if (dependentTypes != null) {
    for(SType<?> d : dependentTypes ) {
      if (type.isTypeOf(d)) {
        return true;
      } else if (d.hasDirectOrInderectDependentType(type)) {
        return true;
      }
    }
  } else if (superType != null) {
    return superType.hasDirectOrInderectDependentType(type);
  }
  return false;
}
origin: org.opensingular/form-core

/**
 * Busca por um ancestral de <code>node</code> cujo tipo é um ancestral comum do tipo de <code>node</code>
 * e <code>targetType</code>.
 * @param node instância inicial da busca
 * @param targetType tipo de outro campo
 * @return Optional da instância do ancestral comum
 */
@SuppressWarnings("unchecked")
public static <CA extends SInstance & ICompositeInstance> Optional<CA> findCommonAncestor(SInstance node, SType<?> targetType) {
  for (SScope type = targetType; type != null; type = type.getParentScope()) {
    for (SInstance ancestor = node; ancestor != null; ancestor = ancestor.getParent()) {
      if (SType.class.isAssignableFrom(type.getClass()) && ancestor.getType().isTypeOf((SType<?>) type) && ancestor instanceof ICompositeInstance) {
        return Optional.of((CA) ancestor);
      }
    }
  }
  return Optional.empty();
}
origin: org.opensingular/form-core

/**
 * Lista os ancestrais de <code>node</code>.
 * @param instance instância inicial da busca
 * @return Lista das instâncias de ancestrais do tipo especificado
 */
public static List<SInstance> listAscendants(SInstance instance, SType<?> limitInclusive, boolean selfIncluded) {
  List<SInstance> list = new ArrayList<>();
  if (selfIncluded) {
    list.add(instance);
  }
  SInstance node = instance.getParent();
  while (node != null && !node.getType().isTypeOf(limitInclusive)) {
    list.add(node);
    node = node.getParent();
  }
  return list;
}
origin: org.opensingular/form-core

/** Retorna o primeiro diff que encotrar na árvore que é do tipo informado ou de sub tipo do tipo informado. */
final Optional<DiffInfo> findFirst(SType<?> field) {
  return findFirst(diff -> (diff.getOriginal() != null && diff.getOriginal().getType().isTypeOf(field)) ||
      (diff.getNewer() != null && diff.getNewer().getType().isTypeOf(field)));
}
origin: org.opensingular/singular-form-wicket

/**
 * This method create a predicate for verify if the instance have a element with the sortableProperty.
 * <p>Note: This verify with the name of the Stype.
 *
 * @return Predicate verify if have a Stype with the <code>sortableProperty</code> for a SIntance.
 */
private Predicate<SInstance> isCurrentSortInstance() {
  return i -> i.getType().isTypeOf(i.getType().getDictionary().getType(sortableProperty))
    || SFormUtil.findChildByName(i, sortableProperty).isPresent();
}
org.opensingular.formSTypeisTypeOf

Javadoc

Verificar se o tipo atual é do tipo informado, diretamente ou se é um tipo extendido. Para isso percorre toda a hierarquia de derivação do tipo atual verificando se encontra parentTypeCandidate na hierarquia.

Ambos o tipo tem que pertencer à mesma instância de dicionário para serem considerado compatíveis, ou seja, se dois tipo forem criados em dicionário diferentes, nunca serão considerado compatíveis mesmo se proveniente da mesma classe de definição.

Popular methods of SType

  • asAtr
  • getNameSimple
  • getName
  • asAtrProvider
  • getAttributeValue
  • isList
    Verificar se o tipo é um tipo lista ( STypeList).
  • getValidators
  • withView
  • asAtrBootstrap
  • getInstanceClass
  • isComposite
    Verificar se o tipo é um tipo composto ( STypeComposite).
  • getDependentTypes
  • isComposite,
  • getDependentTypes,
  • getDictionary,
  • hasAttributeDefinedInHierarchy,
  • isDependentType,
  • newInstance,
  • addAttribute,
  • addDependentType,
  • addInstanceValidator

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • addToBackStack (FragmentTransaction)
  • onRequestPermissionsResult (Fragment)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top plugins for WebStorm
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