congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
SInstance.getType
Code IndexAdd Tabnine to your IDE (free)

How to use
getType
method
in
org.opensingular.form.SInstance

Best Java code snippets using org.opensingular.form.SInstance.getType (Showing top 20 results out of 315)

origin: org.opensingular/form-core

@Override
@SuppressWarnings("unchecked")
public STypeCode<SICode<T>, T> getType() {
  return (STypeCode<SICode<T>, T>) super.getType();
}
origin: org.opensingular/singular-form-core

@Override
@SuppressWarnings("unchecked")
public STypeCode<SICode<T>, T> getType() {
  return (STypeCode<SICode<T>, T>) super.getType();
}
origin: org.opensingular/singular-form-core

  @Override
  public boolean visitChildren(Object object) {
    if (object instanceof SInstance) {
      SInstance ins = (SInstance) object;
      if (type.isAssignableFrom(ins.getType().getClass())) {
        return false;
      }
    }
    return true;
  }
}
origin: org.opensingular/singular-form-core

  public default IBehaviorContext update(SInstance... fields) {
    SType<?>[] types = new SType<?>[fields.length];
    for (int i = 0; i < fields.length; i++)
      types[i] = fields[i].getType();
    update(types);
    return this;
  }
}
origin: org.opensingular/form-core

public SType<?> getTipo() {
  if (target == null) {
    throw new SingularFormException("O objeto alvo dos atributos não foi definido");
  }
  if (target instanceof SType) {
    return (SType<?>) target;
  }
  return ((SInstance) target).getType();
}
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/singular-form-core

@Nonnull
public static <A extends SType<?>> Optional<SInstance> findAncestor(SInstance node, Class<A> ancestorType) {
  for (SInstance parent = node.getParent(); parent != null; parent = parent.getParent()) {
    if (parent.getType().getClass().equals(ancestorType)) {
      return Optional.of(parent);
    }
  }
  return Optional.empty();
}
origin: org.opensingular/form-core

public SingularFormException add(SInstance instance) {
  if (instance != null) {
    add("instancia path", instance.getPathFull());
    add("instancia classe", instance.getClass().getName());
    add("instancia type", instance.getType());
    if (! instance.getType().getClass().getPackage().equals(STypeString.class.getPackage())) {
      add("instancia type class", instance.getType().getClass().getName());
    }
  }
  return this;
}
origin: org.opensingular/singular-form-core

public static List<SType<?>> getFields(SIComposite instance) {
  List<SType<?>> list = new ArrayList<>();
  instance.getAllChildren().forEach(child -> addFieldToList(child.getType(), list));
  return list;
}
origin: org.opensingular/form-core

  @Override
  public void validate(IInstanceValidatable<SIComposite> v) {
    Set<Boolean> nullValues = v.getInstance().streamDescendants(false)
      .filter(it -> it.getType() instanceof STypeSimple<?, ?>)
      .map(it -> it.getValue() == null)
      .collect(toSet());
    
    // os campos devem ser todos nulos ou todos preenchidos
    if (nullValues.size() != 1)
      v.error("Endereço incompleto");
  }
}
origin: org.opensingular/singular-form-core

public static Object fieldValue(SInstance instance) {
  Optional<RelationalColumnConverter> converter = aspectRelationalColumnConverter(instance.getType());
  if (converter.isPresent()) {
    return converter.get().toRelationalColumn(instance);
  }
  return instance.getValue();
}
origin: org.opensingular/singular-form-core

@Override
public void load(SInstance instance, List<RelationalData> fromList) {
  for (SInstance item : getChildren(instance)) {
    RelationalSQL.persistenceStrategy(item.getType()).load(item, fromList);
  }
}
origin: org.opensingular/singular-form-service

private boolean setDateValue(SInstance instance) {
  SType type = instance.getType();
  STypeSimple typeSimple = (STypeSimple) type;
  if (typeSimple instanceof STypeDate
      || type instanceof STypeDateTime
      || type instanceof STypeTime) {
    dateValue = (Date) typeSimple.convert(instance.getValue(), typeSimple.getValueClass());
    return true;
  }
  return false;
}
origin: org.opensingular/form-wicket

public String getReadOnlyFormattedText(WicketBuildContext ctx, IModel<? extends SInstance> model) {
  final SInstance mi = model.getObject();
  if (mi != null && mi.getValue() != null) {
    Serializable instanceObject = mi.getType().asAtrProvider().getConverter().toObject(mi);
    if (instanceObject != null) {
      return mi.getType().asAtrProvider().getDisplayFunction().apply(instanceObject);
    }
  }
  return StringUtils.EMPTY;
}
origin: org.opensingular/singular-form-wicket

@SuppressWarnings("unchecked")
public <ST extends SType<?>> List<SInstance> getChoices(IFunction<T, ST> typeFinder) {
  SInstance          subInstance = resolveTypeFinderInstance(typeFinder);
  ST                 subtype     = (ST) subInstance.getType();
  Component          component   = getComponentForSType(subtype);
  SInstanceConverter converter   = subInstance.asAtrProvider().getConverter();
  return (List<SInstance>) ((AbstractChoice) component).getChoices().stream().map(serializable -> {
    SInstance choiceInstance = subtype.newInstance();
    converter.fillInstance(choiceInstance, (Serializable) serializable);
    return choiceInstance;
  }).collect(Collectors.toList());
}
origin: org.opensingular/singular-form-core

/**
 * Executa as inicilização de atribuição de valor da instância (ver {@link SType#withInitListener(IConsumer)}). Pode
 * sobrepor valores preexistentes.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public final void init() {
  //Não deve chamar o init se estiver no modo de leitura do XML
  if (!getDocument().isRestoreMode()) {
    ((SType) getType()).init(() -> this);
  }
}
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-core

protected void updateInternal(@Nonnull SIComposite instance, SIComposite previousPersistedInstance,
    Integer inclusionActor) {
  for (SInstance field : instance.getAllChildren()) {
    if (RelationalSQL.isListWithTableBound(field.getType())) {
      updateFieldInternal(instance, previousPersistedInstance, inclusionActor, field);
    }
  }
  if (execScript(RelationalSQL.update(instance, previousPersistedInstance).toSQLScript()) == 0) {
    throw new SingularFormNotFoundException(FormKey.fromInstance(instance));
  }
}
origin: org.opensingular/form-wicket

  private void buildHeader(BSContainer<?> header, Form<?> form, IModel<SIList<SInstance>> list,
               WicketBuildContext ctx, SViewListByTable view, boolean isEdition) {

    final IModel<String> label = $m.ofValue(ctx.getCurrentInstance().getType().asAtr().getLabel());
    final Label          title = new Label("_title", label);

    ctx.configureContainer(label);
    header.appendTag("span", title);
//        header.add($b.visibleIf($m.get(() -> !Strings.isNullOrEmpty(label.getObject()))));

    final SType<SInstance> elementsType = list.getObject().getElementsType();

    if (!elementsType.isComposite() && elementsType.asAtr().isRequired()) {
      title.add($b.classAppender("singular-form-required"));
    }

  }

origin: org.opensingular/singular-form-wicket

private TableListPanel buildPanel(WicketBuildContext ctx, ConfirmationModal confirmationModal, String id) {
  final IModel<SIList<SInstance>> list = new ReadOnlyCurrentInstanceModel<>(ctx);
  final ViewMode viewMode = ctx.getViewMode();
  final Boolean isEdition = viewMode == null || viewMode.isEdition();
  final SIList<SInstance> iList = list.getObject();
  final SType<?> currentType = ctx.getCurrentInstance().getType();
  addInitialNumberOfLines(currentType, iList, ctx.getViewSupplier(SViewListByTable.class));
  return TableListPanel.TableListPanelBuilder.build(id,
    (h, form) -> buildHeader(h, form, list, ctx, isEdition),
    (c, form) -> builContent(c, form, list, ctx, isEdition, confirmationModal),
    (f, form) -> buildFooter(f, form, ctx));
}
org.opensingular.formSInstancegetType

Popular methods of SInstance

  • getDocument
    Retorna o documento ao qual pertence a instância atual.
  • toStringDisplay
  • getId
    Retorna um ID único dentre as instâncias do mesmo documento. Um ID nunca é reutilizado, mesmo se a i
  • getAttributeValue
  • findNearest
    Returns the nearest SInstance for the given type in the form SInstance tree. The search is performed
  • setId
    Apenas para uso nas soluções de persistencia. Não deve ser usado fora dessa situação.
  • clearInstance
    Apaga os valores associados a instância. Se for uma lista ou composto, apaga os valores em profundid
  • getName
  • getParent
  • getValue
  • isEmptyOfData
    Retorna true se a instancia não conter nenhuma informação diferente de null. A pesquisa é feita em
  • asAtr
  • isEmptyOfData,
  • asAtr,
  • asAtrAnnotation,
  • asAtrProvider,
  • attachEventCollector,
  • detachEventCollector,
  • getDictionary,
  • getField,
  • getPathFromRoot

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • getApplicationContext (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Collectors (java.util.stream)
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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