interface

How to map composite-id with fluent nhibernate using an interface?

安稳与你 提交于 2019-12-31 02:08:08
问题 I'm trying to switch out .hbm mappings to fluent mappings and have a problem with the mapping of composite-ids and the usage of Interfaces the Class looks as follows: public class ClassWithCompositeId { public virtual IKeyOne KeyOne { get; set; } public virtual IKeyTwo KeyTwo { get; set; } } our hbm mapping looks like this: <hibernate-mapping ...> <class name="ClassWithCompositeId" table="t_classwithcompositeid"> <composite-id> <key-many-to-one name="KeyOne" column="colkeyone" class="company

Android: Exception using Closeable interface with Socket

为君一笑 提交于 2019-12-30 23:52:49
问题 When I try to close a socket through its Closeable interface, I get an exception: new java.net.Socket().close(); // no error ((java.io.Closeable) new java.net.Socket()).close(); // Throws: java.lang.IncompatibleClassChangeError: interface not implemented Why is that? The problem is only on Android devices, not on Java programs running on desktop. 回答1: To quote Android issue tracker: Socket implements Closeable only since API level 19 (kitkat) but that information isn't in the generated

Dealing with circular strong references in Delphi

我的梦境 提交于 2019-12-30 18:33:52
问题 I got two classes (in my example TObject1 and TObject2) which know each other via interfaces (IObject1, IObject2). As you probably know in Delphi this will lead to a memory leak as both reference counter will always stay above zero. The usual solution is declaring one reference as weak. This works in most cases because you usually know which one will be destroyed first or don't necessarily need the object behind the weak reference once it is destroyed. This said I tried to solve the problem

MEF & separate Interface assembly leads to “Interface for every class”

末鹿安然 提交于 2019-12-30 18:27:40
问题 I'm getting my feet wet with DI/IoC and MEF in particular. I have a web application that has two types of parts (maybe more someday) defined by interfaces which need access to the whole environment. The application has a list with concrete implementations for each type, composed by MEF. The environment consists of: several repositories current application request render engine navigation engine plus some static utility classes How can I put the Interface definitions in a seperate assembly and

MEF & separate Interface assembly leads to “Interface for every class”

社会主义新天地 提交于 2019-12-30 18:26:13
问题 I'm getting my feet wet with DI/IoC and MEF in particular. I have a web application that has two types of parts (maybe more someday) defined by interfaces which need access to the whole environment. The application has a list with concrete implementations for each type, composed by MEF. The environment consists of: several repositories current application request render engine navigation engine plus some static utility classes How can I put the Interface definitions in a seperate assembly and

Why does my class implement child interfaces, but not their parents?

孤街醉人 提交于 2019-12-30 17:25:32
问题 I found a (at least for me) unexpected behavior when using interface inheritance in Delphi. I have this simple class and interface hierarchy: +---------------+ | << IMyBase >> | +---------------+ ^ | +---------------+ | << IMyIntf >> | +---------------+ ^ | +---------+ | TMyObj | +---------+ I wanted to declare a variable of type IMyBase . Create a TMyObj and assign it to my variable. IHMO this is normal OOP practice. But it turned out that it does not compile. I Have also tried to declare a

Why is it preferred to have non-virtual interfaces?

喜你入骨 提交于 2019-12-30 14:44:17
问题 I am going through this article http://www.gotw.ca/publications/mill18.htm by Herb Sutter. The author mentions that writing non-virtual interfaces separates the interface specification from the "implementation details (namely the internally customizable behavior)" // Example 1: A traditional base class. // class Widget { public: // Each of these functions might optionally be // pure virtual, and if so might or might not have // an implementation in Widget; see Item 27 in [1]. // virtual int

Golang: what's the point of interfaces when you have multiple inheritence [closed]

此生再无相见时 提交于 2019-12-30 12:04:25
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . I'm a Java programmer, learning to program in Go. So far I really like the language. A LOT more than Java. But there's one thing I'm a bit confused about. Java has interfaces because classes can inherit only from one class. Since Go allows multiple inheritance, what's the

How to add a proper-looking text input field to Firefox toolbar?

给你一囗甜甜゛ 提交于 2019-12-30 11:01:52
问题 I want to have a text input field in toolbar that looks like search input and is controlled by a FF extension. I am using sdk/widget: in main js file I have var reason = require("sdk/widget").Widget({ label: "Progress Block - reason", id: "text-entry", contentURL: data.url("reason.html"), width: 120 }); in reason html file <html> <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <style type="text/css" media="all"> </style> </head> <body> <input type="text" style="width

WPF HiercharchicalDataTemplate.DataType: How to react on interfaces?

霸气de小男生 提交于 2019-12-30 10:43:12
问题 Problem I've got a collection of IThing s and I'd like to create a HierarchicalDataTemplate for a TreeView . The straightforward DataType={x:Type local:IThing} of course doesn't work, probably because the WPF creators didn't want to handle the possible ambiguities. Since this should handle IThing s from different sources at the same time, referencing the implementing class is out of question. Current solution For now I'm using a ViewModel which proxies IThing through a concrete implementation