Questions tagged [wrapper]

A wrapper is an OOP technique where an object encapsulates (wraps) another object, resource (dynamically allocated memory, OS file/widow handle, socket, thread mutex, etc) or a set of subroutines, hiding/protecting it and providing another (possibly easier to use) interface. When using this tag on implementation heavy questions - tag the code language the implementation is written in.

A Wrapper is an Object which contains another data type, Object, resources, or subroutines for the purpose of encapsulation. The corresponding class of that Wrapper is the wrapper class.

Often when we refer to a wrapper class we often refer to a primitive wrapper class, where instances of that class encapsulate a primitive type.

Many object-oriented languages, such as Java, differentiate between primitive types (such as char) and Objects (such as String), for example that primitive values are passed on by value and are the simplest data types, whereas Objects are passed on by reference and that it includes their own fields and methods. The names of primitive data types are also usually keywords, as opposed to Objects.

In some cases, you may need an instance of a wrapper class for these primitives to perform boxing, treat these primitives as Objects due to OOP reasons, converting a primitive to another Object type, or when using an otherwise primitive value when polymorphism is required. The name of the corresponding primitive wrapper class for a given primitive data type are written in full and follow naming conventions for classes (such as beginning with an uppercase in Java).

Java wrapper classes:

Java offers these wrapper classes which you can use without importing anything. Note that their names begin with an uppercase, and are written in full.

  • Boolean for booleans
  • Character for char
  • Integer for int
  • Long for 64-bit int
  • Double for boudle
  • Byte for byte
  • Short for short
  • Float for float

Tags related to wrapper operations:

Link to Wikipedia page

3619 questions
1
vote
1 answer

wrapper to c++/cli

What is the basic structure of a wrapper to c++/cli so it can be called from c# ?
lital maatuk
  • 5,921
  • 20
  • 57
  • 79
1
vote
1 answer

Wrapper for perfect forwarding constructor

I want to make a wrapper for a constructor of a class B. Since some part of the class B is replaceable, I group each implementation of those parts into several class A. I use perfect forwarding to provide a default implementation of A for…
R zu
  • 2,034
  • 12
  • 30
1
vote
1 answer

Does Bigquery support PHP PDO

My organisation is considering moving reporting and data analysis to Google Bigquery from MySQL. Some of the tables in MySQL are populated using PDO in PHP, after reading data from third party APIs. Originally, I created my scripts on MS SQL…
Shahid Thaika
  • 2,133
  • 5
  • 23
  • 59
1
vote
1 answer

Unity Web Request Wrapper

I'm trying to make my own JSON Web Request Wrapper on top of UWR, so it is easier to debug and change all Network requests from one script instead of debugging and changing on each scene But I don't know how to return a string from a coroutine, can…
Chico3001
  • 1,853
  • 1
  • 22
  • 43
1
vote
0 answers

Export data Wrapper API on top of Existing API

[ HttpPost ] public async Task< IHttpActionResult > Calculate(MeasureCalculationRequest measureCalculationRequest ) I have a REST API which will give me list of records based on the pagination I - pass in request. I am trying to create a…
Codex
  • 1,153
  • 1
  • 20
  • 31
1
vote
2 answers

Is there an ant wrapper for scala similar to antwrap in ruby?

Do scala has a wrapper similar to http://antwrap.rubyforge.org/. I understand it would be quick easy to call ant methods directly from the REPL of as a script but was wondering if there is a DSL or wrapper around ant?
charroch
  • 2,170
  • 2
  • 15
  • 14
1
vote
1 answer

setting compile arguments in setup.py file (Or linker arguments? -lrt?)

Below is my setup file to setup a python wrapper. The issue I am having is that in my c code I am writing is making calls to clock_gettime for profiling reasons. The thing is when I try to import the module I get the following: error undefined…
Dick
  • 85
  • 9
1
vote
3 answers

Java Wrapper class reference pointing to a primitive value

I have a doubt in Java wrapper class like Integer, Character. I know that when we declare a class Abc and can create an object to it in Java like Abc a = new Abc(); It instantiates a with reference to Abc class and in that we have fields that…
1
vote
0 answers

Avoid the wrapper.java.additional.=='s value to be displayed in the log file

Is there any way to avoid the display of a wrapper.java.additional in the log file, when we use Java Service Wrapper? For ex: wrapper.java.additional.1=-Bar=Foo will be displayed in the log file like: INFO | jvm 1 |
Bogdan
  • 103
  • 1
  • 2
  • 8
1
vote
1 answer

Writing a client wrapper class to isolate internal details of the client whose class implements IDisposable but interface does not

I am writing a client wrapper around an external client that is defined in a NuGet package. The NuGet package contains below interface and the class. public interface IServiceClient { Task CreateJobAsync(JobDetails jobdetails); } public…
vrcks
  • 419
  • 1
  • 5
  • 23
1
vote
1 answer

How to access C# .dll Properties when using a C++ wrapper

I am writing a wrapper for a C# .dll to be used by a c++ program. I have the functions working but I am not sure how to access/set-up the properties in the wrapper so they are accessible. The properties are of all different data types, some are read…
user4019882
1
vote
1 answer

Strange memory behaviour when using Python C API

I am trying to implement a Python wrapper using the Python C API over a C++ library. I need to implement conversions so I can use objects in Python and C++. I already done that in the past but I have an error I really have a hard time with. I have…
baptiste
  • 1,107
  • 2
  • 15
  • 30
1
vote
0 answers

Python wrapper to C function producing segmentation error

I am building a Python wrapper to a C code. In the .c code I have the following defined function double myfunction_at_k_and_z(struct background * pba, struct spectra * psp, struct perturbs *ppt, …
johnhenry
  • 1,293
  • 5
  • 21
  • 43
1
vote
1 answer

Making C++ to use output from Python functions

This is more of an engineering design question. MiniSAT is the base library to solve SAT problems. It has lots of optimizations already built-in. I am currently working on speeding up a part of that code. However, my code is written in Python, and I…
pg2455
  • 5,039
  • 14
  • 51
  • 78
1
vote
2 answers

Where is opengl located(gpu software or os)?

I am writing an x86 os and a question popped into my mind: If I would want to create a simple opengl game in my os, would I be able to do that without reinventing opengl? SO what I am asking is, is opengl included in e.g. the nvideo drivers, or is…
user2083443
1 2 3
99
100