How to access UProperty (meta) from an UObject class?

I’ve tried to search, read source, but can’t wrap my head around.

class SomeClassA : public UObject
...
UPROPERTY(config, meta = (UIMin = "1", UIMax = "8", ClampMin = "1", ClampMax = "8"))
int32 VariableA;
...

class SomeClassB : public UObject
...
GetMutableDefault<SomeClassA>()->VariableA = VariableB;
....

Now, I want to make sure that VaribleA still in the range, how to reference the ClampMin/ClampMax values?

I’ve found

FPropertyHandleInt::SetValue

And it seems does what I want, but have no clue how to access it from my class.

I should say that I’m not looking for:

 SomeClassA::StaticClass()->FindPropertyByName(TEXT("VariableA"))->GetMetaData(TEXT("ClampMin");

If you’re not looking for the metadata, what do you want? An existing function that will clamp a value based on that, without having to rewrite it yourself?

It would be useful to know in what context you are assigning the new value. Presumably it’s part of an editor module? What triggers it?

Yep. An existing function that would clip it.
The value is a part of editor module.
It is triggered by a function that called on Tick (may be triggered, in some particular case). It is working as part of the main editor viewport loop.

Probably, title with “FPropertyHandleInt” would make more sense, but I’m not sure if FPropertyHandleInt is what I’m looking for.

From what I can see there is no such reusable function available. The clamping metadata is apparently intended just for the UI input stage (there is no metadata in a packaged build after all).

The only two places I could see in the engine code that used it to clamp were when setting up a a widget for the property (not applicable to your case) and in the property handle implementation. Property handles are also used specifically within the details panel/property editor code. I’ve looked into creating one myself before as they have some useful functionality, but I gave up; they’re just buried very deep in non-exposed code and it’s pretty clear they’re not intended to be created outside of that area of the engine code.

If you want to use those values, I think you’ll need to extract them yourself with the function you mentioned, convert (see TTypeToString< int32 >::FromString) and then clamp.