methods

List all methods of a given class, excluding parent class's methods in PHP

I'm building a unit testing framework for PHP and I was curious if there is a way to get a list of an objects methods which excludes the parent class's methods. So given this: class Foo { public function doSomethingFooey() { echo 'HELLO THERE!'; } } class Bar extends Foo { public function goToTheBar() { ...

C# how can a delegate & interface method interchangable

Can I use interface method instead of delegate? How? I found searching that interface method is faster than using delegates. I would appreciate a simple code snippet. ...

Having a Dll made by dot net , is there any way to distinguish its methods?

hi Having a Dll made by dot net , is there any way to distinguish its methods? ...

invoking method using Reflection Utils

hi, i want to invoke a method using reflection. i am having two projects AA and BB. AA has dependency on BB but BB does not have. Now the use case is that i have to call a class of AA from BB. can any one suggest me how to do that.. i have used ReflectionUtils class for the same.. Method getMethod = null; getMethod = ReflectionUtils....

Is it possible to get a reference to a Java method to invoke it later?

Is it possible to obtain references to an object's methods? For example, I'd like to have a method that invokes other methods as callbacks. Something like: public class Whatever { public void myMethod(Method m,Object args[]) { } } Is this possible? EDIT: I meant an object's methods. I take it it's not possible? ...

C# what is the point or benefit of an indexer?

Doing some code reading and stumbled upon this snippet that I haven't seen before: public SomeClass { public someInterface this[String strParameter] { get { return SomeInternalMethod(strParameter); } } } It looks like it is called as follows: SomeClass _someClass = new SomeClass(); SomeInterface returnedValue = _som...

java class, extending external API functionality

Hello, I have an external API (I can't modify it) with class "A" and local class "B" which overrides methods of "A" and adds an additional function. I need to use one of them according to some parameter "is_A". /------ API (A.java) -----/ package A; public class A { public int pingA( int value ) { return value; } } /------ m...

I need a good analogy to make sense of Class methods vs. instance methods

Im getting fairly confused as the book im reading is delving into the NSNumber class and talks about all the different methods you can call on it. I have a couple questions: 1.) Do you not have to call a typical alloc or init on foundation classes? 2.)in what cases would you use, say, numberWithChar: as opposed to initWithChar (i thin...

Allow or disallow method run in .NET

Hi! I need to organize some simple security in a class depends on value of the enum. All that I can figure out is using attribute on a method and then run check then if it fails throw an exception. Sample: [ModulePermission(PermissonFlags.Create)] public void CreateNew() { CheckPermission(); System.Windows.Fo...

F# Riddle: how to call an overload of a method?

First part: call F# from F# Let's say we have the following type defined in F#: type MyClass = static member Overload1 (x, y) = "Pim" static member Overload1 (x : System.Tuple<_, _>) = "Pam" static member Overload1 x = "Pum" You are now in another module (in another file). How can you call each of the three methods shown...

Elementary Obj-C Question bout Methods

Hi, take example: -(void)setName:(NSString *)name age:(int)age; How would you call this method (in other words, the method's name is setName but what is the "age" parameter doing in there) and what do the types in parentheses mean? Is it just a way to tell the compiler what types are being returned? ...

Ruby multiple named arguments

Hello, I'm very new to ruby and I'm trying to write a web application using the rails framework. Through reading I've seen methods being called like this: some_method "first argument", :other_arg => "value1", :other_arg2 => "value2" Where you can pass an unlimited number of arguments. How do you create a method in ruby that can be u...

method architecture, returning the supplied object.

Hello. And thanks for any suggestions. I am building a client facing web service, but am struggling with a design implementation. For each of the service methods, an object is passed as a parameter IE: The CreateCustomer method accepts a Customer object. The issue that I am having is with the response. What I have currently in pla...

how to create function inside another function in c#,is it possible?

how to create function inside another function in c#,is it possible? ...

Overriding an instance method with static ones

I have a class that will be subclassed. All subclasses must contain a static method with the same signature, but differnt for each one. I would like to have an abstract instance method in the superclass that subclasses will override, but it seems mot possible in Java, I wonder why. A silly example: Image{ abstract String getExtensio...

Extend an existing attribute getter in rails model

Hello all, i have a problem using acts_as_textiled and has_foreign_language plugins together. TextElement my model in my app class TextElement < ActiveRecord::Base has_foreign_language :value acts_as_textiled :value HasForeignLanguage def has_foreign_language(*args) args.each do |field| # Define the Getter ...

How to implement method chaining?

In C# how does one implement the ability to chain methods in one's custom classes so one can write something like this: myclass.DoSomething().DosomethingElse(x); etc... Thanks! ...

Java generics extending return type of methods

Take a look at these three classes. Minatchi allows itself to be extended so that its methods' returning type could be extended as well. To illustrate, I used a static method. public class Minatchi<T extends Minatchi<?>>{ static public <T extends Minatchi<?>> List<T> listAll(){ return (List<T>) query(); } } And ...

Smaller Methods

Following the guidelines given in "Clean Code" by Uncle Bob Martin, I'm trying to make my methods smaller. One recommendation he gives is that methods that contain a trys should invoke other methods that don't involve the exceptional cases. My problem is one of naming. Usually by the time my method only contains the try expression, th...

Reusing ASP.Net URL

Can I reuse a bookmarked url [GET Method ;Framework ASP.Net Db Oracle] after logging off?? ...