interface

Make an object searchable with array_search in PHP

Hi, I would like to make a class in PHP such as it would be searchable with PHP native method array_search. Currently my class implements IteratorAggregate and Countable, which allows me to do foreach on it. There is a couple of other SPL interfaces (SeekableIterator, ArrayAccess, etc...) which seems to maybe fit, but I would like to k...

Java - Instantiating objects of type X when all you have is the reference type

I had a quick look at the "Related Questions" suggested but I couldn't find one directly related to what I'm asking. Even if there was one, I'd still appreciate your opinion on the best way to do this. First some context. I'm working on extending a Java Application and I have the following Interface and Class: public interface Mapper {...

Can I see the "final" C# code when viewing an interface's methods?

What I'm trying to say is, if an object is defined as an interface, then instantiated from a class factory, is it possible in VS 2008 to right click on a method call from that object and see the real code, instead of the interface's empty signature? In other words there's a lot of this in our code: ISomeInterface myObject = ObjectCrea...

Compile a Java class against an interface even if none was specified

I'm teaching an intro to programming course and we're using Java. I want to help the students learn how to translate a written class specification into a working program. I will provide the written specification. It specifies the name of the class and behavior in the form of method signatures. I want the students to translate that into a...

How to expose a method in an interface without making it public to all classes

I have a issue where I'm working with a particular interface for quite a lot of things. However, I have a particular method that I want to be available only to a particular group of classes (basically, an internal method). interface IThing { function thisMethodIsPublic():void; function thisMethodShouldOnlyBeVisibleToCertainClas...

XCode: Possible to auto-create stubs for methods required by Protocol interface?

Coming from an Eclipse / Java background, one of my favorite features is the ability to quickly stub out all the methods required by an interface. In Eclipse, I can choose 'Override / implement' from the source menu to generate stub methods for any method of the Interface. I'd like to do the same thing in Objective-C. For instance, if...

Is it possible to change visual studio 2008 interface language?

Hi all, I've installed a copy of a Spanish version of visual studio 2008 (professional edition) on my computer and I was wondering if there is a possible or if exist some language pack that change this interface to English. I did some research but I wasn't find anything useful for VS2008 professional. Thanks ...

Hibernate One-to-one Mapping with interface.i need advice

hello good people i'm developping an application where all the pojos are exposed as interface but we map the real implementation class.we are using spring and JPA annotation.i'm about to test the one-to-one relationship and i'm having a light problem with the interface. Caused by: org.springframework.beans.factory.BeanCreationExcepti...

Interfaces and function return types (with Linq)

I have two interfaces: Interface iContact Property ContactID As String Function Services() As System.Linq.IQueryable(Of iService) End Interface Interface iService Property ServiceID As String End Interface I have a host app that implements these (properties skipped for brevity): Class Contact Inherits iContact F...

Useful Inheritance in Python resp. Alternative for interfaces

Hi as far as I see in Python variables are untyped. So now I want to have a baseclass class baseClass: def x(): print "yay" and two subClasses class sub1(baseClass): def x(): print "sub1" class sub2(baseClass): def x(): print "sub2" in other programming languages I can develop against interfaces just like baseClass c =...

Why can't you cast from IList<IParent> to IList<IChild> where IChild implements IParent

Possible Duplicate: IList<Type> to IList<BaseType> I am programming in C# using .NET 2.0 and I don't understand why the cast below results in a null reference. If you have an IList<IChild>, why can't you cast it to an IList<IParent> where IChild implements IParent. using System.Collections.Generic; namespace InterfaceTest { ...

InsertOnSubmit with interfaces (LINQ to SQL)

In our code we have: public interface ILogMagazine { string Text { get; set; } DateTime DateAndTime { get; set; } string DetailMessage { get; set; } } SimpleDataContext: DataContext { public Table<ILogMagazine> LogMagaines { get { return GetTable<ILogMagazine>(); } } } We try to: DataContext db = new SimpleDataContext...

toString(), equals(), and hashCode() in an interface...

So, I have an interface with a bunch of methods that need to be implemented, the method names are irrelevant. The objects that implement this interface are often put into collections, and also have a special toString() format that I want them to use. So, I thought it would be convenient to put hashCode(), equals(), and toString() into ...

Property & Private & extended class combination confusion of interface

I have downloaded a sample code of AA-Plot Chart. One of the .h files: @interface MainViewController : UIViewController <APYahooDataPullerDelegate, CPPlotDataSource> { CPLayerHostingView *layerHost; @private APYahooDataPuller *datapuller; CPXYGraph *graph; } @property (nonatomic, retain) IBOutlet CPLayerHostingView *la...

How to write Audit methods in Java?

Hi folks, As my java application increases in complexity i want to write audit methods to make sure that i am doing the right thing. How can i do it in java? thx ...

Determining child interface closest to a class

Lets say I have a inheritance tree of interfaces: IParent > IChild > IGrandChild How would I: Find a class that implements IParent Determine the closest ancestor of the class that is also a child of IParent. For example: var myClass = FindImplementor<IParent>(); var myInterface = ClosestAncestor<IParent, myclass>(); I'm not look...

Interface Inheritance in C++

I have the following class structure: class InterfaceA { virtual void methodA =0; } class ClassA : public InterfaceA { void methodA(); } class InterfaceB : public InterfaceA { virtual void methodB =0; } class ClassAB : public ClassA, public InterfaceB { void methodB(); } Now the following code is not compilable: int...

Where to put the interfaces in a component based architecture?

In a component based architecture where a large number of decoupled components communicate through a set of standardized interfaces - are there any guidelines for where-to-store / how-to-group the interfaces? Extreme solutions would be: All in the same assembly (and off you go) One assembly for each interface Both of these option se...

Java interface static method workaround?

We have a given REST interface: POST /calculation <data>abc</data> This calculation can be implemented by different logical "calculators" depending on the server config. We are now designing the Java interface that each calculator must implement. The interface will have a method for each REST service. Given that all REST (and H...

How to return an object that implements an interface from a method

I'm trying to learn interfaces and want to try the following: Let's say I have an interface named ICustomer that defines basic properties (UserID, UserName, etc). Now, I have multiple concrete classes like ProductA_User, ProductB_User, ProductC_User. Each one has different properties but they all implement ICustomer as they are all cu...