Package com.inspiresoftware.lib.dto.geda.assembler.extension

Examples of com.inspiresoftware.lib.dto.geda.assembler.extension.MethodSynthesizer


           AnnotationValidatingBindingException, GeDARuntimeException  {

        final PropertyDescriptor dtoFieldDesc = PropertyInspector.getDtoPropertyDescriptorForField(
                dtoClass, meta.getDtoFieldName(), dtoPropertyDescriptors);

        final MethodSynthesizer synthesizer = context.getMethodSynthesizer();

        final DataReader dtoFieldRead = meta.isReadOnly() ? null : synthesizer.synthesizeReader(dtoFieldDesc);
        final DataWriter dtoFieldWrite = synthesizer.synthesizeWriter(dtoFieldDesc);


        final boolean isMapEntity = Map.class.isAssignableFrom(entityClass);
        final boolean isListEntity = !isMapEntity && List.class.isAssignableFrom(entityClass);

        final MethodSynthesizer entitySynthesizer;
        final PropertyDescriptor entityFieldDesc;

        if (isMapEntity || isListEntity) {
            if (isMapEntity) {
                entitySynthesizer = mapSynthesizer;
            } else {
                entitySynthesizer = listSynthesizer;
            }
            entityFieldDesc = dtoFieldDesc;
        } else {
            entitySynthesizer = synthesizer;
            entityFieldDesc = PropertyInspector.getEntityPropertyDescriptorForField(
            dtoClass, entityClass, meta.getDtoFieldName(), meta.getEntityFieldName(), entityPropertyDescriptors);
        }

    final DataReader entityFieldRead = entitySynthesizer.synthesizeReader(entityFieldDesc);
    final DataWriter entityFieldWrite = meta.isReadOnly() ? null : entitySynthesizer.synthesizeWriter(entityFieldDesc);

        return new MapPipe(context,
                dtoFieldRead, dtoFieldWrite,
                entityFieldRead, entityFieldWrite,
                meta);
View Full Code Here


        final boolean isListEntity = !isMapEntity && List.class.isAssignableFrom(entityClass);

    final PropertyDescriptor dtoFieldDesc = PropertyInspector.getDtoPropertyDescriptorForField(
        dtoClass, meta.getDtoFieldName(), dtoPropertyDescriptors);

        final MethodSynthesizer synthesizer = context.getMethodSynthesizer();
        final MethodSynthesizer entitySynthesizer;
    final PropertyDescriptor entityFieldDesc;
        if (isMapEntity || isListEntity) {
            if (isMapEntity) {
                entitySynthesizer = mapSynthesizer;
            } else {
                entitySynthesizer = listSynthesizer;
            }
            entityFieldDesc = dtoFieldDesc;
        } else {
            entitySynthesizer = synthesizer;
            entityFieldDesc = PropertyInspector.getEntityPropertyDescriptorForField(
        dtoClass, entityClass, meta.getDtoFieldName(), meta.getEntityFieldName(), entityPropertyDescriptors);
        }
   
    final DataReader dtoParentReadMethod;
   

    if (meta.isChild()) {
      final Method parentGet = dtoFieldDesc.getReadMethod();

            Class returnTypeClass;
            try {
                returnTypeClass = PropertyInspector.getClassForType(parentGet.getGenericReturnType());
            } catch (GeDARuntimeException gre) {
                throw new GeDARuntimeException(
                        "Generics tree is too complex only rawTypes are supported class: " + dtoClass.getSimpleName()
                                + ", method: " + parentGet.getName(), gre);
            }

            final PropertyDescriptor[] dtoSubPropertyDescriptors = PropertyInspector.getPropertyDescriptorsForClass(returnTypeClass);
      final PropertyDescriptor dtoParentDesc = PropertyInspector.getDtoPropertyDescriptorForField(
          dtoClass, meta.getParentEntityPrimaryKeyField(), dtoSubPropertyDescriptors);
      dtoParentReadMethod = context.getMethodSynthesizer().synthesizeReader(dtoParentDesc);

    } else {
     
      dtoParentReadMethod = null;
     
    }
   
    return new DataPipe(context,
                meta.isReadOnly() ? null : synthesizer.synthesizeReader(dtoFieldDesc),
        synthesizer.synthesizeWriter(dtoFieldDesc),
        dtoParentReadMethod,
                entitySynthesizer.synthesizeReader(entityFieldDesc),
        meta.isReadOnly() ? null : entitySynthesizer.synthesizeWriter(entityFieldDesc),
        meta
    );
  }
View Full Code Here

 
  /** {@inheritDoc} */
  public DataReader synthesizeReader(final PropertyDescriptor descriptor)
      throws InspectionPropertyNotFoundException,
      UnableToCreateInstanceException, GeDARuntimeException {
    final MethodSynthesizer syn = lazyGet(clRef.get(), null);
    return syn.synthesizeReader(descriptor);
  }
View Full Code Here

  /** {@inheritDoc} */
  public DataWriter synthesizeWriter(final PropertyDescriptor descriptor)
      throws InspectionPropertyNotFoundException,
      UnableToCreateInstanceException, GeDARuntimeException {
    final MethodSynthesizer syn = lazyGet(clRef.get(), null);
    return syn.synthesizeWriter(descriptor);
  }
View Full Code Here

    return syn.synthesizeWriter(descriptor);
  }

  /** {@inheritDoc} */
  public boolean configure(final String configuration, final Object value) throws GeDAException {
    final MethodSynthesizer syn;
    if ("synthesizerImpl".equals(configuration)) {
      syn = lazyGet(clRef.get(), value);
      return true;
    } else {
      syn = lazyGet(clRef.get(), null);
    }
    return syn.configure(configuration, value);
  }
View Full Code Here

        AUTOBINDING.put(cacheKey, classes);
        return classes;
  }

    private static MethodSynthesizer getDefaultSynthesizer(final ClassLoader classLoader) {
        MethodSynthesizer syn = CL_SYNTHESIZER.get(classLoader);
        if (syn == null) {
            syn = new MethodSynthesizerProxy(classLoader);
            CL_SYNTHESIZER.put(classLoader, syn);
        }
        return syn;
View Full Code Here

                   InspectionScanningException, UnableToCreateInstanceException, InspectionPropertyNotFoundException,
                   InspectionBindingNotFoundException, AnnotationMissingBindingException, AnnotationValidatingBindingException,
                   GeDARuntimeException, AnnotationDuplicateBindingException {

        final Class< ? > realEntity = filterBlacklisted(entity);
        final MethodSynthesizer synthesizer = getDefaultSynthesizer(classLoader);
        final int key = createAssemblerKey(dto, realEntity, synthesizer, null);

        final Assembler asm = getAssemblerFromCache(classLoader, key);
        if (asm != null) {
            return asm;
View Full Code Here

                   InspectionScanningException, UnableToCreateInstanceException, InspectionPropertyNotFoundException,
                   InspectionBindingNotFoundException, AnnotationMissingBindingException, AnnotationValidatingBindingException,
                   GeDARuntimeException, AnnotationDuplicateBindingException {

        final Class< ? > realEntity = filterBlacklisted(entity);
        final MethodSynthesizer synthesizer = getDefaultSynthesizer(classLoader);
        final int key = createAssemblerKey(dto, realEntity, synthesizer, registry);

        final Assembler asm = getAssemblerFromCache(classLoader, key);
        if (asm != null) {
            return asm;
View Full Code Here

            throws AnnotationMissingException, InspectionInvalidDtoInstanceException, InspectionInvalidEntityInstanceException,
                   InspectionScanningException, UnableToCreateInstanceException, InspectionPropertyNotFoundException,
                   InspectionBindingNotFoundException, AnnotationMissingBindingException, AnnotationValidatingBindingException,
                   GeDARuntimeException, AnnotationDuplicateBindingException {

        final MethodSynthesizer synthesizer = getDefaultSynthesizer(classLoader);
        final int key = createAssemblerKey(dto, entities, synthesizer, null);

        final Assembler asm = getAssemblerFromCache(classLoader, key);
        if (asm != null) {
            return asm;
View Full Code Here

                   AnnotationMissingBindingException, AnnotationValidatingBindingException, GeDARuntimeException,
                   AnnotationDuplicateBindingException  {

        final Class[] classes = detectAutobinding(dto);

        final MethodSynthesizer synthesizer = getDefaultSynthesizer(classLoader);
        final int key = createAssemblerKey(dto, classes, synthesizer, null);

        final Assembler asm = getAssemblerFromCache(classLoader, key);
        if (asm != null) {
            return asm;
View Full Code Here

TOP

Related Classes of com.inspiresoftware.lib.dto.geda.assembler.extension.MethodSynthesizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.