interface

Android Custom Event

和自甴很熟 提交于 2019-12-13 00:19:28
问题 I am new to Android and Java development and am looking to implement a custom event, however having done lots of research and trying various different approaches i cannot seem to get it to work. I am essentially trying to create a battle system, which i have implemented in .NET but cannot seem to get working in Java, it requires me to create events for things such as DealtDamage, DamageReceived, Died etc. This will be inherteing information from the characters object which consits of thing

Implementing large interface

牧云@^-^@ 提交于 2019-12-12 23:14:50
问题 I am using a library that has a large interface interface IOrder{ cutomerId: number; deliveryAddress1: string; // and lots of properties... } And I want to implement a class extending it. Just want to confirm that it is necessary to re-declare all the properties. class Order implements IOrder{ cutomerId: number; /* error: Class 'Order' incorrectly implements interface 'IOrder'. Property 'deliveryAddress1' is missing in type 'Order' */ } Of course, methods need to be implemented but I find re

MissingMethodException after extracting base interface

£可爱£侵袭症+ 提交于 2019-12-12 23:12:15
问题 I split an interface, inside a Nuget package library, into a simpler base interface (without one property from the original), and made the original derive from the new base interface. Instantiation in consuming applications happens through Managed Extensibility Framework (MEF), using property injection with [Import] attributes, and implementations with [Export(typeof(IFooConfigurations))] This shouldn't be a breaking change, for applications using the old interface and implementation. But in

Interfaces and Late Binding in C#

自古美人都是妖i 提交于 2019-12-12 22:30:30
问题 I've done this before in C# for a plugin system which works fine, which is why I'm puzzled as to why this new, separate plugin system is not working the way I would expect. I have my plugin assembly - let's call it "plugin.dll" and I have my main assembly - let's call it App.exe. I have an interface called IMyObject and its implementation, MyObject and both are defined in plugin.dll. I've copied the exact code file for IMyObject (which the plugin developer has provided to me) into my main App

EJB 3.1 Problems with JNDI Stand-Alone Application with GlassFish 4

◇◆丶佛笑我妖孽 提交于 2019-12-12 20:35:17
问题 I'm having a problem with the JNDI section of a stand-alone test application. I have the gf-client.jar and the jndi-properties.jar file on the class path. I made sure that the latest version was deployed on the glassfish server before running the client as well. Stand-Alone Application: public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws NamingException { Context context = new InitialContext(); TestBeanRemote bean = (TestBeanRemote

Inheritance and interfaces

假装没事ソ 提交于 2019-12-12 19:52:18
问题 This is somewhat of a follow-up question to this question. Suppose I have an inheritance tree as follows: Car -> Ford -> Mustang -> MustangGT Is there a benefit to defining interfaces for each of these classes? Example: ICar -> IFord -> IMustang -> IMustangGT I can see that maybe other classes (like Chevy ) would want to implement Icar or IFord and maybe even IMustang , but probably not IMustangGT because it is so specific. Are the interfaces superfluous in this case? Also, I would think that

Is it possible for TypeScript to infer keys from a dynamic object?

 ̄綄美尐妖づ 提交于 2019-12-12 19:15:36
问题 What I'm trying to achieve here is intellisense/autocomplete for an object that's been generated from an array - something like an Action Creator for Redux, an array of strings ( string[] ) that can be reduced to an object with shape { [string]: string } . For example: const a = ['ONE', 'TWO', 'THREE']; const b = a.reduce((acc, type) => ({ ...acc, [type]: type }), {}); console.log(b); // Output: b = { ONE: 'ONE', TWO: 'TWO', THREE: 'THREE' }; I've managed to get TypeScript to understand that

Calling a Generic Interface Method does not work

百般思念 提交于 2019-12-12 18:53:08
问题 I got a generic interface with one method accepting a parameter of the generic type: public interface ComponentRenderer<T extends GuiComponent> { public void draw(T component); } Furthermore I have an abstract class, that declares a variable of this interface type using a bounded wildcard: public abstract class GuiComponent extends Gui { private ComponentRenderer<? extends GuiComponent> componentRenderer; public void draw() { this.componentRenderer.draw(this); } //and a setter and getter for

Java Interface Observable

喜夏-厌秋 提交于 2019-12-12 18:36:25
问题 I have the following: A Java class: ClassA implements Observer A Java Interface: Inter (extends Observable, not possible) A Java class: ClassB implements Inter extends Observable A Java class: ClassC implements Inter extends Observable Now the code for ClassA is somewhat like this. ClassA{ Inter anyClass = new ClassB(); //or it could be Inter anyClass = new ClassC(); //Inter.addObserver(this); //not possible since Interface cannot extend Observable } Now if a particular event happens in

Open a Window since Programm class?

扶醉桌前 提交于 2019-12-12 17:54:52
问题 I have a console application. So I need Open a Window called "UserInterface.xaml" this is a Window. I my class Program I have this: class Program { [STAThread] static void Main(string[] args) { var userInterface = new UserInterface(); userInterface .Show(); } The problem is when the UserInterface.xaml is opened but then is closed immediately. And I need it for capture some data from user. this is my class UserInterface: public partial class UserInterface: Window { public UserInterface() {