Tabnine Logo
BoundMapperFacade
Code IndexAdd Tabnine to your IDE (free)

How to use
BoundMapperFacade
in
ma.glasnost.orika

Best Java code snippets using ma.glasnost.orika.BoundMapperFacade (Showing top 20 results out of 315)

origin: arey/java-object-mapper-benchmark

  @Override
  public OrderDTO map(Order source) {
    return orderMapper.map(source);
  }
};
origin: ma.glasnost.orika/orika-core

for (int i=0, len = usedMapperFacades.size(); i < len; ++i) {
  BoundMapperFacade<Object,Object> dedicatedFacade = usedMapperFacades.get(i);
  if (dedicatedFacade.getAType().equals(sourceType) && dedicatedFacade.getBType().equals(destinationType)) {
    result.index = i;
    break;
  } else if (dedicatedFacade.getAType().equals(destinationType) && dedicatedFacade.getBType().equals(sourceType)) {
    result.index = i;
    result.isReversed = true;
origin: elaatifi/orika

public A mapReverse(B instanceB, A instanceA, MappingContext context) {
  return wrapped.mapReverse(instanceB, instanceA, context);
}
origin: elaatifi/orika

GenericDto result = mapper.mapReverse(source);
MapWithoutSetter mapBack = mapper.map(result);
Assert.assertTrue(source.getScores().keySet().containsAll(mapBack.getScores().keySet()));
Assert.assertTrue(mapBack.getScores().keySet().containsAll(source.getScores().keySet()));
origin: elaatifi/orika

public Type<B> getBType() {
  return wrapped.getBType();
}
origin: elaatifi/orika

public Type<A> getAType() {
  return wrapped.getAType();
}
origin: elaatifi/orika

  public A newObjectReverse(B source, MappingContext context) {
    return wrapped.newObjectReverse(source, context);
  }
}
origin: elaatifi/orika

public B newObject(A source, MappingContext context) {
  return wrapped.newObject(source, context);
}
origin: elaatifi/orika

readerDTO.setBooks(bookDTOs);
Reader reader = mapper.mapReverse(readerDTO);
Reader reader2 = mapper2.map(readerDTO);
origin: drtrang/Copiers

@Override
public T copy(F source) {
  checkNotNull(source, "source bean cannot be null!");
  try {
    return copier.map(source);
  } catch (Exception e) {
    throw new CopierException("create object fail, class: " + targetClass.getName(), e);
  }
}
origin: elaatifi/orika

@Test
public void testInverseManyToOneMapping() {
  MapperFactory factory = MappingUtil.getMapperFactory();
  
  ClassMapBuilder<BookDTO, Book> classMapBuilder = factory.classMap(BookDTO.class, Book.class);
  classMapBuilder.fieldMap("author").bInverse("books").add();
  factory.registerClassMap(classMapBuilder.byDefault().toClassMap());
  
  /*
   * Doesn't matter which direction you ask for the bound mapper;
   */
  BoundMapperFacade<Book, BookDTO> mapper = factory.getMapperFacade(Book.class, BookDTO.class);
  BoundMapperFacade<BookDTO, Book> mapper2 = factory.getMapperFacade(BookDTO.class, Book.class);
  
  AuthorDTO authorDTO = new AuthorDTO();
  authorDTO.setFirstName("Khalil");
  authorDTO.setLastName("Gibran");
  
  BookDTO bookDTO = new BookDTO();
  bookDTO.setTitle("The Prophet");
  bookDTO.setAuthor(authorDTO);
  
  Book book = mapper.mapReverse(bookDTO);
  Book book2 = mapper2.map(bookDTO);
  
  Assert.assertTrue(book.getAuthor().getBooks().contains(book));
  
  Assert.assertTrue(book2.getAuthor().getBooks().contains(book2));
}
 
origin: elaatifi/orika

for (int i=0, len = usedMapperFacades.size(); i < len; ++i) {
  BoundMapperFacade<Object,Object> dedicatedFacade = usedMapperFacades.get(i);
  if (dedicatedFacade.getAType().equals(sourceType) && dedicatedFacade.getBType().equals(destinationType)) {
    result.index = i;
    break;
  } else if (dedicatedFacade.getAType().equals(destinationType) && dedicatedFacade.getBType().equals(sourceType)) {
    result.index = i;
    result.isReversed = true;
origin: elaatifi/orika

public A mapReverse(B instanceB) {
  return wrapped.mapReverse(instanceB);
}
origin: drtrang/Copiers

@Override
public void copy(F source, T target) {
  checkNotNull(source, "source bean cannot be null!");
  checkNotNull(target, "target bean cannot be null!");
  try {
    copier.map(source, target);
  } catch (Exception e) {
    throw new CopierException("create object fail, class: " + targetClass.getName(), e);
  }
}
origin: elaatifi/orika

public A mapReverse(B instanceB, MappingContext context) {
  return wrapped.mapReverse(instanceB, context);
}
origin: elaatifi/orika

@Test
public void testMapToMapGeneration_noSetter() throws Exception {
  
  
  MapperFactory factory = MappingUtil.getMapperFactory();
  factory.registerClassMap(
      factory.classMap(MapWithSetter.class, MapWithoutSetter.class)
      .field("testScores", "scores").byDefault());
  
  BoundMapperFacade<MapWithSetter, MapWithoutSetter> mapper = factory.getMapperFacade(MapWithSetter.class, MapWithoutSetter.class);
  
  MapWithSetter source = new MapWithSetter();
  Map<String, Integer> testScores = new LinkedHashMap<String, Integer>();
  testScores.put("A", 90);
  testScores.put("B", 80);
  testScores.put("C", 70);
  source.setTestScores(testScores);
  
  
  MapWithoutSetter result = mapper.map(source);
  
  Assert.assertNotNull(result);
  Assert.assertNotNull(result.getScores());
  for (Entry<String, Integer> entry: testScores.entrySet()) {
    Assert.assertEquals(entry.getValue().toString(), result.getScores().get(entry.getKey()));
  }
  
}
 
origin: elaatifi/orika

public A mapReverse(B instanceB, A instanceA) {
  return wrapped.mapReverse(instanceB, instanceA);
}
origin: elaatifi/orika

@Test
public void testMapToMapGeneration() throws Exception {
  
  
  MapperFactory factory = MappingUtil.getMapperFactory();
  factory.registerClassMap(
      factory.classMap(MapWithSetter.class, MapWithSetterDto.class)
      .field("testScores", "scores").byDefault());
  
  BoundMapperFacade<MapWithSetter, MapWithSetterDto> mapper = factory.getMapperFacade(MapWithSetter.class, MapWithSetterDto.class);
  
  MapWithSetter source = new MapWithSetter();
  Map<String, Integer> testScores = new LinkedHashMap<String, Integer>();
  testScores.put("A", 90);
  testScores.put("B", 80);
  testScores.put("C", 70);
  source.setTestScores(testScores);
  
  
  MapWithSetterDto result = mapper.map(source);
  
  Assert.assertNotNull(result);
  Assert.assertNotNull(result.getScores());
  for (Entry<String, Integer> entry: testScores.entrySet()) {
    Assert.assertEquals(entry.getValue(), result.getScores().get(entry.getKey()));
  }
  
}
 
origin: elaatifi/orika

@Test
public void testListToArray() {
  BoundMapperFacade<A,D> mapperFacade = MappingUtil.getMapperFactory().getMapperFacade(A.class, D.class);
  
  D source =  new D();
  source.setBuffer(Arrays.asList((byte)1,(byte)2,(byte)3,(byte)4));
  A destination = mapperFacade.mapReverse(source);
  Assert.assertArrayEquals(new byte[] {(byte)1,(byte)2,(byte)3,(byte)4}, destination.getBuffer());
  
}
 
origin: elaatifi/orika

source.setIntArray(GeneratedObjectBase.intArray(numericScores));
MapWithoutSetter result = mapper.map(source);
ma.glasnost.orikaBoundMapperFacade

Javadoc

BoundMapperFacade represents a caching mapper configuration which is bound to a given pair of types.

Most used methods

  • map
    Generates a new instance of the 'B' type based on the specified instance of 'A'
  • getAType
  • getBType
  • mapReverse
    Generates a new instance of the 'A' type based on the specified instance of 'B'
  • newObject
    Returns a new instance of type B, using source instance of A for context
  • newObjectReverse
    Returns a new instance of type A, using source instance of B for context

Popular in Java

  • Reading from database using SQL prepared statement
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • setScale (BigDecimal)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • ImageIO (javax.imageio)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook extensions
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