All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gorm.tools.metamap.GormEntityConverter.groovy Maven / Gradle / Ivy

There is a newer version: 7.3.74
Show newest version
/*
* Copyright 2013 Yak.Works - Licensed under the Apache License, Version 2.0 (the "License")
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
package gorm.tools.metamap

import groovy.transform.CompileStatic

import org.grails.datastore.gorm.GormEntity

import gorm.tools.utils.GormMetaUtils
import yakworks.meta.MetaMap

/**
 * MetaMap.Converter default to just show id for the gormEntity if nothing is specified.
 *
 */
@CompileStatic
class GormEntityConverter implements MetaMap.Converter {

    @Override
    boolean handles(Object value) {
        GormEntity.isAssignableFrom(value.class)
    }

    @Override
    Object convert(Object value, String key) {
        def obj = (GormEntity)value
        return GormMetaUtils.getIdMap(obj)
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy