Questions tagged [proxy-classes]

A proxy class is a class functioning as an interface to another class or a service. Proxy classes are implementation of Proxy design pattern. These classes help using large objects or other resources that are expensive or impossible to duplicate.

342 questions
13
votes
1 answer

creating Java Proxy instance for a class type?

I have the following code that works for creating a Proxy instance for an interface type backed by an InvocationHandler implementation, however when I use a concrete class type it doesn't work and this is well known and documented in…
SkyWalker
  • 13,729
  • 18
  • 91
  • 187
12
votes
3 answers

How to unwrap the original object from a dynamic proxy

what's the best approach to unwrap a dynamic proxy to retrieve the original object beneath? The dynamic proxy has been created using java.lang.reflect.Proxy.newProxyInstance() Thank you.
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
12
votes
2 answers

Why won't DynamicProxy's interceptor get called for *each* virtual method call?

An example explains it best : public interface IA { void foo(); void bar(); } public class A : IA { public virtual void foo(){ Console.Write("foo"); bar(); //call virtual method } public virtual void bar(){ …
Cristian Diaconescu
  • 34,633
  • 32
  • 143
  • 233
12
votes
2 answers

Could multiple proxy classes make up a STL-proof bitvector?

It's well known that std::vector does not satisfy the Standard's container requirements, mainly because the packed representation prevents T* x = &v[i] from returning a pointer to a bool. My question is: can this be remedied/mitigated when…
TemplateRex
  • 69,038
  • 19
  • 164
  • 304
11
votes
1 answer

Error when using AutoMapper to map from a POCO to an NHibernate proxy object

We recently upgraded AutoMapper and ran into an issue when mapping items a certain way. When I load an NHibernate domain object, and attempt to map my model to it in the following manner: var myPoco = new MyPoco(); var proxy =…
Erik
  • 123
  • 1
  • 6
10
votes
3 answers

Passing temporaries as non-const references in C++

I have the following piece of code, as an example dec_proxy attempts to reverse the effects of the increment operator upon the type that is executed in a complex function call foo - which btw I cannot change the interface of. #include…
Xander Tulip
  • 1,438
  • 2
  • 17
  • 32
10
votes
5 answers

Java/JSF/Tomcat/Spring - Proxy-Object has different methods than original object

today I ran into this problem which really bugs me, as almost the code already worked (and stopped working even after reverting to the older version). I'm accessing a Spring-Bean on a Facelets-Page. Spring wraps these objects in Proxies to use…
Robert M.
  • 1,339
  • 1
  • 12
  • 34
10
votes
3 answers

WCF generated proxy throws InvalidOperationException due to multiple types with same name in WSDL

I'm using Visual Studio 2013 to generate a WCF service proxy from this WSDL file. However, as soon as I try to call the setSalesItemsV3 method, WCF throws an InvalidOperationException from deep in System.Xml.dll. This sample project demonstrates the…
Stephen Jennings
  • 12,494
  • 5
  • 47
  • 66
9
votes
2 answers

How to Proxy a Promise in JavaScript es6

I'm trying to Proxy a Promise in native Firefox (and using Babel). var prom = new Promise(function(resolve, reject){resolve(42)}); var promProxy = new Proxy(prom, {}); promProxy.then(function(response){console.log(response)}); This doesn't…
sam
  • 3,498
  • 3
  • 22
  • 19
9
votes
2 answers

UndeclaredThrowableException thrown by IndexOutOfBoundsException

I am using the decorator pattern for a List.Part of this decoration entails using a proxy. When I call get(index) with an index that is out of bounds, it throws an IndexOutOfBounds exception, which is then caught by the proxy, and…
Nathan Merrill
  • 7,648
  • 5
  • 37
  • 56
9
votes
1 answer

NHibernate Get objects without proxy

I am using NHibernate(2.0.1.4) with NHibernate.Linq(1.0.0.4) to get Objects of the type Node from the Database. When I get these objects, the last object of the collection I got is of the type Proxy (because I used "NHibernate.ByteCode.LinFu"" ) I…
Jan
  • 9,858
  • 7
  • 26
  • 33
9
votes
1 answer

How do I make a class, which I can't change, implement an interface?

I have a class from another library that is closed-source, but I want to be able to use an interface for it. The reason being that I don't want to do instanceof checks or null-checks everywhere, but I also don't want to extend the existing…
Brian
  • 17,079
  • 6
  • 43
  • 66
8
votes
1 answer

Doctrine 2 proxy classes breaking Symfony2 ACL

When attempting to run findAcl() on an entity with an existing entry in the acl_classes table generated by init:acl I get an AclNotFoundException. Testing with createAcl() on the object in question before calling findAcl() shows a new record in…
Lord_Baine
  • 83
  • 6
8
votes
1 answer

dynamic proxies with jmx can cause thread leaks?

I have a problem in Java where I set up a dynamic proxy with a JMX interface, pass this on to another component which then makes calls to the proxy object. When I do this, the application leaks two threads for each call, threads which never seem to…
Stefan Thyberg
  • 3,445
  • 3
  • 23
  • 29
8
votes
3 answers

Can I stop service reference generating ArrayOfString instead of string[]?

I have a web method with a signature like this: public string[] ToUpper(string[] values) I am using the 'Add Service reference' in Visual Studio 2010 to generate a reference to my service. Unfortunately, this process creates a proxy class called…
Luke Baulch
  • 3,626
  • 6
  • 36
  • 44
1
2
3
22 23