• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TypeConverter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.mongodb.morphia.converters.TypeConverter的典型用法代码示例。如果您正苦于以下问题:Java TypeConverter类的具体用法?Java TypeConverter怎么用?Java TypeConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TypeConverter类属于org.mongodb.morphia.converters包,在下文中一共展示了TypeConverter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addConverters

import org.mongodb.morphia.converters.TypeConverter; //导入依赖的package包/类
private void addConverters(final MappedClass mc) {
    final List<Annotation> convertersList = mc.getAnnotations(Converters.class);
    if (convertersList != null) {
        for (Annotation a : convertersList) {
            final Converters c = (Converters) a;
            if (c != null) {
                for (final Class<? extends TypeConverter> clazz : c.value()) {
                    if (!getConverters().isRegistered(clazz)) {
                        getConverters().addConverter(clazz);
                    }
                }
            }
        }

    }
}
 
开发者ID:mongodb,项目名称:morphia,代码行数:17,代码来源:Mapper.java


示例2: configure

import org.mongodb.morphia.converters.TypeConverter; //导入依赖的package包/类
@Override
protected void configure() {
    Multibinder<TypeConverter> mb = Multibinder
            .newSetBinder(binder(), TypeConverter.class);
    bind(new TypeLiteral<GeometryConverter<BSONObject>>() {
    }).to(GeoBSON.class);
    mb.addBinding().to(DateTimeConverter.class);
    mb.addBinding().to(DurationConverter.class);
    mb.addBinding().to(FileConverter.class);
    mb.addBinding().to(JTSConverter.class);
    mb.addBinding().to(URLConverter.class);
    mb.addBinding().to(DimensionedNumberConverter.class);
    mb.addBinding().to(TrackSummariesConverter.class);
}
 
开发者ID:enviroCar,项目名称:enviroCar-server,代码行数:15,代码来源:MongoConverterModule.java


示例3: MongoDB

import org.mongodb.morphia.converters.TypeConverter; //导入依赖的package包/类
@Inject
public MongoDB(Injector injector,
               Set<TypeConverter> converters,
               @Named(MAPPED_CLASSES) Set<Class<?>> mappedClasses,
               @Named(HOST_PROPERTY) String host,
               @Named(PORT_PROPERTY) int port,
               @Named(DATABASE_PROPERTY) String database,
               @Nullable @Named(USER_PROPERTY) String username,
               @Nullable @Named(PASS_PROPERTY) char[] password) {
    try {
        MorphiaLoggerFactory.registerLogger(SLF4JLoggerImplFactory.class);
        if (username == null) {
            mongo = new MongoClient(new ServerAddress(host, port));
        }
        else {
            mongo = new MongoClient(new ServerAddress(host, port), Collections.singletonList(
                MongoCredential.createMongoCRCredential(username, database, password)));
        }
        
        morphia = new Morphia();
        morphia.getMapper().getOptions().setObjectFactory(new CustomGuiceObjectFactory(new DefaultCreator(), injector));
        addConverters(converters);
        addMappedClasses(mappedClasses);
        
        datastore = morphia
                .createDatastore(mongo, database);
        datastore.ensureIndexes();
        ensureIndexes();
        datastore.ensureCaps();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:enviroCar,项目名称:enviroCar-server,代码行数:34,代码来源:MongoDB.java


示例4: addConverters

import org.mongodb.morphia.converters.TypeConverter; //导入依赖的package包/类
private void addConverters(Set<TypeConverter> converters) {
    converters.forEach(getMapper().getConverters()::addConverter);
}
 
开发者ID:enviroCar,项目名称:enviroCar-server,代码行数:4,代码来源:MongoDB.java


示例5: configure

import org.mongodb.morphia.converters.TypeConverter; //导入依赖的package包/类
@Override
protected void configure() {
       bind(DataService.class).to(DataServiceImpl.class);
       bind(AccessRights.class).to(NonRestrictiveRights.class);
       bind(DataService.class).to(DataServiceImpl.class);
       bind(UserService.class).to(UserServiceImpl.class);
       bind(FriendService.class).to(FriendServiceImpl.class);
       bind(GroupService.class).to(GroupServiceImpl.class);
       bind(StatisticsService.class).to(StatisticsServiceImpl.class);
       bind(PasswordEncoder.class).to(BCryptPasswordEncoder.class);
       bind(UserStatisticService.class).to(UserStatisticServiceImpl.class);
       bind(GeometryOperations.class).to(GeodesicGeometryOperations.class);
       Multibinder.newSetBinder(binder(), TypeConverter.class);
       bind(new TypeLiteral<GeometryConverter<BSONObject>>() {
       }).to(GeoBSON.class);
       bind(new TypeLiteral<JSONEntityDecoder<Measurement>>() {
       }).to(MeasurementDecoder.class);
       bind(new TypeLiteral<JSONEntityDecoder<Geometry>>() {
       }).to(GeoJSONDecoder.class);
       install(new FactoryModuleBuilder()
       .implement(User.class, MongoUser.class)
       .implement(Group.class, MongoGroup.class)
       .implement(Track.class, MongoTrack.class)
       .implement(UserStatistic.class, MongoUserStatistic.class)
       .implement(Measurement.class, MongoMeasurement.class)
       .implement(MeasurementValue.class, MongoMeasurementValue.class)
       .implement(Phenomenon.class, MongoPhenomenon.class)
       .implement(Sensor.class, MongoSensor.class)
       .implement(Fueling.class, MongoFueling.class)
       .build(EntityFactory.class));
       install(new FactoryModuleBuilder()
       .implement(Activity.class, MongoActivity.class)
       .implement(GroupActivity.class, MongoGroupActivity.class)
       .implement(TrackActivity.class, MongoTrackActivity.class)
       .implement(UserActivity.class, MongoUserActivity.class)
       .build(ActivityFactory.class));
       bind(UserDao.class).to(MongoUserDao.class);
       bind(GroupDao.class).to(MongoGroupDao.class);
       bind(TrackDao.class).to(MongoTrackDao.class);
       bind(UserStatisticDao.class).to(MongoUserStatisticDao.class);
       bind(MeasurementDao.class).to(MongoMeasurementDao.class);
       bind(SensorDao.class).to(MongoSensorDao.class);
       bind(StatisticsDao.class).to(MongoStatisticsDao.class);
       bind(PhenomenonDao.class).to(MongoPhenomenonDao.class);
       bind(ActivityDao.class).to(MongoActivityDao.class);
       bind(TermsOfUseDao.class).to(MongoTermsOfUseDao.class);
       bind(AnnouncementsDao.class).to(MongoAnnouncementsDao.class);
       bind(BadgesDao.class).to(MongoBadgesDao.class);
       bind(PasswordResetDAO.class).to(MongoPasswordResetDAO.class);
       bind(FuelingDao.class).to(MongoFuelingDao.class);
       bind(CarSimilarityService.class).to(CarSimilarityServiceImpl.class);
}
 
开发者ID:enviroCar,项目名称:enviroCar-server,代码行数:53,代码来源:EncodingTestModule.java



注:本文中的org.mongodb.morphia.converters.TypeConverter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TypeMap类代码示例发布时间:2022-05-23
下一篇:
Java MapPosition类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap