properties

How to store meta information of properties in a class

末鹿安然 提交于 2021-01-29 11:17:21
问题 I want to associate metadata to properties in classes, specifically abbreviations of property names. With annotations: @shortName(abbreviated) you can tag each property: function shortName(shortName: string){ return function (target: Object, realName: string){ // Where to store the relation realName <-> shortName ?? } } class Record{ @shortName("ts") typeOfStorage: string; } class Client extends Record{ @shortName("df") descriptiveField: string; } function mapNames(obj: any){ // Return object

Setting Label and StaticText Color property problem - Delphi 2009

倖福魔咒の 提交于 2021-01-28 22:51:28
问题 When I set the Label 's color e.g. on value clRed , the red on it only blink for a while. The color property still has clRed value, but in fact it has default clBtnFace color. Screenshot discribes the problem better. 回答1: Set Transparent to False. :-) Edit: assuming it's a TLabel, as shown in the screenshot. 回答2: Do you mean a TLabel or a TPanel ? Your screenshot shows a label, but it should work for both components. Make sure that the ParentColor property is set to false . 来源: https:/

Get all @properties from a Python Class [duplicate]

痴心易碎 提交于 2021-01-28 21:34:38
问题 This question already has answers here : In a Python object, how can I see a list of properties that have been defined with the @property decorator? (5 answers) Closed 7 days ago . In Python, how can I get all properties of a class, i.e. all members created by the @property decorator? There are at least two questions [1, 2] on stackoverflow which confound the terms property and attribute , falsely taking property as a synonym for attribute , which is misleading in Python context. So, even

Setting Label and StaticText Color property problem - Delphi 2009

青春壹個敷衍的年華 提交于 2021-01-28 20:50:29
问题 When I set the Label 's color e.g. on value clRed , the red on it only blink for a while. The color property still has clRed value, but in fact it has default clBtnFace color. Screenshot discribes the problem better. 回答1: Set Transparent to False. :-) Edit: assuming it's a TLabel, as shown in the screenshot. 回答2: Do you mean a TLabel or a TPanel ? Your screenshot shows a label, but it should work for both components. Make sure that the ParentColor property is set to false . 来源: https:/

Grouping/inheriting properties for tasks in Gradle

北城余情 提交于 2021-01-28 12:11:04
问题 Is there a way to reuse property groups in Gradle? Something that would look like: def propGroup = [ options.fork = true options.forkOptions.executable = ... ] task compileThis(type:JavaCompile) { options.fork = propGroup.options.fork options.forkOptions.setExecutable(propGroup.options.forkOptions.executable) destinationDir = file(xxx) } task compileThat(type:JavaCompile) { options.fork = propGroup.options.fork options.forkOptions.setExecutable(propGroup.options.forkOptions.executable)

Call a method as property or function?

一个人想着一个人 提交于 2021-01-28 09:56:04
问题 Is it possible to have a method and call it as either function or property? def Foo: def bar(self,x=1,y=2): return x+y foo=Foo() foo.bar #should return 3 foo.bar(4,5) #should return 9 It seems to be impossible, because: foo.bar will call __getattribute__ ; if it's a descriptior, __get__ will be called from within __getattribute__ , meaning that bar() is evaluated before it's even returned to the caller if an attribute is a function, it only returns a function and then () is applied to that

Issue with custom TypeConverter and nested properties in the designer

拜拜、爱过 提交于 2021-01-27 21:52:17
问题 I'm trying to add a nested property to my custom control using a TypeConverter, here is my test code: public class TestNestedOptionConverter : TypeConverter { public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] filter) { return TypeDescriptor.GetProperties(typeof(TestNestedOption)); } public override bool GetPropertiesSupported(ITypeDescriptorContext context) { return true; } } [TypeConverter(typeof(TestNestedOptionConverter))]

How to declare the default indexed property in C++/CLI interface

浪子不回头ぞ 提交于 2021-01-27 20:31:01
问题 how is it possible to declare the default indexed property in an C++/CLI - Interface. (Please excuse the repeating, full qualified notation with namespaces because I'm just learning C++/CLI and want to be sure that no acciential mixup of language primitives between C++ and C# happens) Code is public interface class ITestWithIndexer { property System::String ^ default[System::Int32]; } Compiler always throws "error C3289: 'default' a trivial property cannot be indexed". Where is my error? PS:

How can I set same Value for multiple Keys in Java properties?

拜拜、爱过 提交于 2021-01-27 18:40:49
问题 I wish to achieve something like - File.properties contains, prop1, prop2 = valueX prop3, prop4 = valueZ where `props.getProperty("prop1");` should return `valueX` I know one way is to write the same value again different keys but that makes my property file cluttered and does not provide an analytical view for the business purpose. PS : If it is somehow possible then, please describe the case where the same key appears with different values. 回答1: I wish to achieve something like File

logging all properties of an object in c#. how to log inner object properties as well?

泄露秘密 提交于 2021-01-27 15:50:27
问题 i am trying to (1) log all properties of an object, and (2) all properties of a specific object type within. i can do the (1) but not (2). this is the case now. foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(object1)) { string name = descriptor.Name; object value = descriptor.GetValue(object1); logger.Debug(String.Format("{0} = {1}", name, value)); } what i need is something like: foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(object1)) { string