JNoSQL Book
  • Eclipse JNoSQL
  • LANGS
  • Eclipse JNoSQL one API to many NoSQL databases
    • About me
    • A principal ideia atrás da AP
    • Por que Diana?
    • Bibliografia
    • Credits
    • Introdução ao Diana
      • Value
      • Criando o seu próprio Writer and Reader
      • Element Entity
      • Document
      • Column
      • Entidade
      • ColumnFamilyEntity
      • DocumentEntity
      • KeyValueEntity
      • Manager
      • Column Manage
      • Document Manage
      • Bucket Manager
      • Factory
      • Column Family Manager Factory
      • Document Family Manager Factory
      • Bucket Manager Factory
      • Configuration
      • Document Configuration
      • Column Configuration
      • Key Value Configuration
    • Diversidade nos Bancos não relacionais
      • Utilizando drivers para com o Diana
    • Introdução ao Artemis
      • Anotações para o Modelo
      • Classes templates
      • Template de Documentos
      • Template de Família de Colunas
      • Template de Chave valor
      • CrudRepository
      • Lidando com os eventos da persistência
      • Bean Validation
    • Componentes do Artemis
      • Workflow
      • EventManager
      • Converter
      • As classes respositórios
    • SUMMARY
    • introduction
  • Eclipse JNoSQL one API para vários bancos NoSQL
    • introduction
    • The main idea behind the API
      • Why Diana?
    • Diana Introduction
      • Value
      • Make custom Writer and Reader
      • Element Entity
      • Document
      • Column
      • Entity
      • ColumnFamilyEntity
      • DocumentEntity
      • KeyValueEntity
      • Manager
      • Document Manager
      • Column Manager
      • Bucket Manager
      • Factory
      • [[Column Family Manager Factory](en/part2/chapter2_5_1.md)
      • Document Collection Factory
      • Bucket Manager Factory
      • Configuration
      • Document Configuration
      • Column Configuration
      • Key Value Configuration
    • The diversity on NoSQL databases
      • Using Diana drivers
      • Implementing a Document Driver
    • Artemis introduction
      • Models Annotation
      • Template classes
      • Document Template
      • Column Family Template
      • Key-value Template
      • Repository
      • Persistence events
      • Bean Validation
    • Artemis components
      • Workflow
      • EventManager
      • Converter
      • The repository class
    • SUMMARY
    • README
    • credits
    • About me
  • LICENSE
Powered by GitBook
On this page
  1. Eclipse JNoSQL one API para vários bancos NoSQL
  2. Diana Introduction

Value

This interface represents the value that will store, that is a wrapper to be a bridge between the database and the application. Eg. If a database does not support a Java type, it may do the conversion with easily.

Value value = Value.of(12);

The Value interface has the methods:

  • Object get(); Returns the value as Object

  • <T> T get(Class<T> clazz); Does the conversion process to the required type that is the safer way to do it. If the type required doesn't have support it will throw an exception, although, the API allows to create custom converters.

  • <T> T get(TypeSupplier<T> typeSupplier); Similar to the previous method, it does the conversion process but using a structure that uses generics such as List, Map, Stream and Set.

        Value value = Value.of(12);
        String string = value.get(String.class);
        List<Integer> list = value.get(new TypeReference<List<Integer>>() {});
        Set<Long> set = value.get(new TypeReference<Set<Long>>() {});
        Stream<Integer> stream = value.get(new TypeReference<Stream<Integer>>() {});
        Object integer = value.get();
PreviousDiana IntroductionNextMake custom Writer and Reader

Last updated 6 years ago