Questions tagged [reflect]

103 questions
12
votes
1 answer

Error: Can't resolve all parameters for ApplicationModule: (?)

I want to create Angular application without CLI. After that I get an error: Error: Can't resolve all parameters for ApplicationModule: (?). Project contains couple files, main of this is: • main.ts import 'zone.js/dist/zone' import {…
piecioshka
  • 3,136
  • 1
  • 17
  • 27
4
votes
1 answer

React-Native Realm TypeError: Reflect.construct requires the first argument be a constructor - Error

I reinstalled the MacOs operating system, my working code has failed. I don't understand, it was working before reinstalling. My project detail is; "react": "16.9.0" "react-native": "0.61.1", "realm": "^3.6.5", I was tried realm 3.2.0 and 3.1.0…
Yusuf
  • 77
  • 7
3
votes
1 answer

Unification in pattern matching case

I was trying to write a function whose type is forall n, option (n = 1). I choose option as an altertnative to reflect avoiding giving the proof of the negative case. So Some plays the role ReflectT and holds the proof, while None doesn't hold the…
12412316
  • 261
  • 2
  • 10
3
votes
2 answers

Java GenericClass< ? extends Interface> as a Parameter

public interface A {} public interface B {} public class Test implements A{} public class Test2 {} I made a method which checks if a class implements an interface. I want my method to only accept generic interfaces and not all class objects.…
3
votes
1 answer

C# Why cannot get the correct instance from ioc, when i use reflect to regist class

I want to register classes from a dll to IOC, but when I get the instance from the IOC, it returns me a null value. As the code below Version_2. But if I use the Version_1, it will return a correct instance. the code as below: private static…
Ryan.Ukule
  • 35
  • 4
3
votes
1 answer

How to assign value into reflect Field()?

I faced such a problem. I need to compare two structure if they type and name of field is equal. To assign value from sour to dist. I write some code, but here I can assign reflect.Field() value. Could you help me? And I create the test in the…
Aibaend
  • 67
  • 11
3
votes
2 answers

How to merge two Go values of same struct type?

I want to create a function called merge() that takes in two values of the same struct, but of any struct, and returns the merged values of the two structs. I want the first value to take precedence. For example, if there are two structs a and b,…
user2990276
  • 117
  • 1
  • 6
3
votes
0 answers

If a KParameter.isOptional = true, how can I get the default value?

My class: data class TestMockModel(val age: Int = 3) How can I get the age's default value by age's KParameter? such val ageKParameter = TestMockModel::class.parameters[0] How can I get the default value by ageKParameter
imuto
  • 31
  • 2
3
votes
1 answer

Deserializing unknown Go's gob blob

I have gobs of unknown type. Is there way to print it to view inside? There might be gob.Debug but it is not available for me https://golang.org/src/encoding/gob/debug.go Googling advices to use DecodeValue but it requires initialised reflect.Value…
user3130782
  • 661
  • 4
  • 11
3
votes
1 answer

JSON marshal of slice made from reflect.New() gives null in golang

I'm using reflect in golang to make a new initialized slice. But the moment I json.Marshal this new reflected slice, I get a JSON null value instead of a []. See this example here where I compare two cases: package main import ( …
John
  • 28,573
  • 67
  • 217
  • 373
2
votes
1 answer

Go Reflect Array

The structure is like: type Auth_msg struct { Msg_class [2]byte Msg_content_pty [2]byte I am fresh to use Reflect in Go and I encounter this: panic: reflect: call of reflect.Value.Bytes on array Value This occurs when I run…
Steve Yang
  • 17
  • 3
2
votes
2 answers

Kotlin Access Property Name from Delegate

I'm writing a saving system for my game using kotlin delegated properties. Here is a small example import kotlin.reflect.KProperty object Test { val test: Int by no_prop { 10 } // I want this val testTwo: Int by prop(::testTwo) { 10 } // I…
Jonathan Beaudoin
  • 2,108
  • 4
  • 25
  • 58
2
votes
0 answers

SQLAlchemy: reflecting tables of existing database not working properly

I am currently engaged in evaluating SQLAlchemy for a new project. When trying to reflect the tables of an existing database (postgres, oracle), I am encountering some issues. In order to connect to an Oracle database the following code is being…
user4338
  • 173
  • 1
  • 10
2
votes
0 answers

Javascript: Access metadata of child class inside constructor of parent

I want to access metadata of a child class in its parent's constructor before the super call. See following example: import "reflect-metadata"; const KEY = Symbol() function Decorator(name: string) { return function(target: any) { …
WaeCo
  • 1,025
  • 8
  • 17
2
votes
1 answer

Is it possible to know whether an Annotation Method is overriden (boolean values)?

I have tried a lot of things online but nothing seem to work for me. I want to know whether an annotation method has been @Overriden (either with the same value as its default). Take a look at this example: public class AnnoTest { @Anno …
George Z.
  • 6,024
  • 4
  • 18
  • 33
1
2 3 4 5 6 7