草庐IT

attached-properties

全部标签

properties - Kotlin 抽象 protected 属性(property)

如果我有以下类层次结构:abstractclassFoo(){abstractprotectedvalthing:T}classBaz:Foo{overrideprotectedvalthing:T=...}我收到关于Baz::thing的警告:Redundantvisibilitymodifier这是否意味着编译器将其视为protected而无需您指定,或者它必须是公开的? 最佳答案 您将在Kotlin中收到一个IDE检查样式警告,例如您不需要的额外分号、已经可以推断的额外泛型类型参数等等。您的冗余可见性修饰符也是如此。如果您展开

properties - Kotlin 抽象 protected 属性(property)

如果我有以下类层次结构:abstractclassFoo(){abstractprotectedvalthing:T}classBaz:Foo{overrideprotectedvalthing:T=...}我收到关于Baz::thing的警告:Redundantvisibilitymodifier这是否意味着编译器将其视为protected而无需您指定,或者它必须是公开的? 最佳答案 您将在Kotlin中收到一个IDE检查样式警告,例如您不需要的额外分号、已经可以推断的额外泛型类型参数等等。您的冗余可见性修饰符也是如此。如果您展开

intellij-idea - 如何在 IntelliJ 中更改 Kotlin 的 'this property has a backing field' 代码编辑器高亮显示?

我的天哪,IntelliJ的这种默认颜色突出显示令人眼花缭乱。我该如何更改? 最佳答案 您修改Kotlin颜色突出显示的方式与修改任何其他语法突出显示的方式相同。您可以在Preferences>Colors&Fonts>Kotlin下找到它。你想要的项目是Propertywithbackingfield。但是请注意KT-6765是我发现的一个错误,除非您还设置了背景颜色,否则不尊重前景色。因此,要更改它,请确保同时设置前景色和背景色,如下所示:我个人选择了与Darcula默认背景大致接近的深色背景。

intellij-idea - 如何在 IntelliJ 中更改 Kotlin 的 'this property has a backing field' 代码编辑器高亮显示?

我的天哪,IntelliJ的这种默认颜色突出显示令人眼花缭乱。我该如何更改? 最佳答案 您修改Kotlin颜色突出显示的方式与修改任何其他语法突出显示的方式相同。您可以在Preferences>Colors&Fonts>Kotlin下找到它。你想要的项目是Propertywithbackingfield。但是请注意KT-6765是我发现的一个错误,除非您还设置了背景颜色,否则不尊重前景色。因此,要更改它,请确保同时设置前景色和背景色,如下所示:我个人选择了与Darcula默认背景大致接近的深色背景。

Homestead 上的 Laravel-echo-server 和 socket.io 得到 TypeError : Cannot read property 'socketId' and 'presenceChannel'

我正在尝试在homestead上使用laravel5.4、laravel-echo、redis和socket-io创建一个实时聊天应用程序。请检查下面的代码,然后检查我的问题ChatConversation事件:classChatConversationimplementsShouldBroadcast{useDispatchable,InteractsWithSockets,SerializesModels;public$message;public$user;/***Createaneweventinstance.**@returnvoid*/publicfunction__con

java - Spring 启动 : Overriding CacheManager bean makes cache related properties not work

我有一个带有Redis缓存的SpringBoot2应用程序。在我覆盖CacheManagerbean之前,它工作得很好。问题:以下配置属性被忽略(我无法再关闭缓存):spring.cache.type=none虽然accordingtothedocumentation它应该工作。问题如何让spring.cache.type=none工作?有一个解决方法likethis,但这远不是一个好的解决方案。更多详细信息:这是我的配置的样子:@ConfigurationpublicclassCacheConfiguration{@BeanRedisCacheWriterredisCacheWrit

properties - 在 Kotlin 中访问属性委托(delegate)

Kotlin具有委托(delegate)属性,这是一个非常好的特性。但有时get()和set()方法是不够的。假设我想懒惰地创建一个Closeable对象并稍后关闭它。以下是如何实现此类委托(delegate)属性的示例:funcloseableLazy(initializer:()->T)=CloseableLazyVal(initializer)classCloseableLazyVal(privatevalinitializer:()->T):ReadOnlyProperty{privatevarvalue:T?=nulloverridefunget(thisRef:Any?,d

properties - 在 Kotlin 中访问属性委托(delegate)

Kotlin具有委托(delegate)属性,这是一个非常好的特性。但有时get()和set()方法是不够的。假设我想懒惰地创建一个Closeable对象并稍后关闭它。以下是如何实现此类委托(delegate)属性的示例:funcloseableLazy(initializer:()->T)=CloseableLazyVal(initializer)classCloseableLazyVal(privatevalinitializer:()->T):ReadOnlyProperty{privatevarvalue:T?=nulloverridefunget(thisRef:Any?,d

node.js - 类型错误 : Cannot read property 'findOne' of undefined

代码如下varmongo=require('mongodb');vardatabaseName='Starter',collectionName='wines';varServer=mongo.Server,Db=mongo.Db,BSON=mongo.BSONPure;db=newDb(databaseName,server);db.open(function(err,db){if(!err){console.log("Connectedto'winedb'database");db.collection(collectionName,{strict:true},function(e

java - 映射异常 : "No property found on entity to bind constructor parameter to"?

我的项目是用springdatamongodb开发的,以前有这个文档:@Document(collection="Instrument")publicclassInstrument{@IdprivateIntegerid;privateStringname;privateStringinternalCode;privateStringfosMarketId;privateStringlocalCode;//setters...getters...andconstructurs....现在我需要向我的文档添加一些属性,如下所示:....privateLongfrom;privateLon