草庐IT

getproperties

全部标签

java - 如何使用 Java 读取 Android 属性

我在终端中使用“adbshellgetprop”。在AndroidJAVA中可以使用哪些接口(interface)来获取相同的信息?我试过几种方法,例如:PropertiessysProps=System.getProperties();但我不认为这些是我正在寻找的相同属性?具体来说,我想找到将返回类似于以下内容的值:adbshellgetprop|grepdolbyshell'grepdolby'命令返回:[audio.dolby.ds2.enabled]:[true][dolby.audio.sink.info]:[headset][dolby.ds.dialogenhancer.

c# - Reflection.Typeinfo/Reflection.Type 没有 GetProperties/GetFields 方法

我正在尝试为Windows8.1和WindowsPhone8.1制作Windows通用应用程序。这是我的问题的示例类,我使用类型int作为示例,但无论我使用什么类,错误都存在:usingSystem;usingSystem.Collections.Generic;usingSystem.Reflection;usingSystem.Text;namespacemyTtrpgHelper{classtestClass{voidtestMethod(){intc=newint();Typetype=c.GetType();TypeInfotypeInfo=IntrospectionExte

java - GetPropertyAction 与 System.getProperty 获取系统变量

我已经用了很多System.getProperty("property")为了获取环境信息。但是,在我看来,Sun更喜欢以下内容:(String)java.security.AccessController.doPrivileged(newsun.security.action.GetPropertyAction("property"));奇怪的是这段代码涉及强制转换,因此应该比System.getProperty实现,仅使用安全管理器,然后立即从实例变量props中获取属性。我的问题是为什么Sun选择使用第二种方法在他们的代码内部获取大部分环境变量,而System.getProper

java - 使用 System.getProperty() 获取 @CucumberOptions 标签属性

我在Eclipse中运行一个maven项目用于我的Cucumber测试。我的测试运行器类如下所示:@RunWith(Cucumber.class)@CucumberOptions(tags={"@Now"},//tags={"@Ready"},//tags={"@Draft"},features={"src/test/java/com/myCompany/FaultReporting/Features"},glue={"com.myCompany.myApp.StepDefinitions"})publicclassRunnerTest{}我不想将标签硬编码到测试运行程序中,而是热衷于

java - System.getProperty ("catalina.base") 可能存在客户端可以使用任何其他服务器的情况

我正在使用从Tomcat\conf\somename.properties目录中读取属性文件Stringdemo=System.getProperty("catalina.base")+File.separator+"conf"+File.separator+"somename.properties";这在Tomcat上工作得很好。但是,在某些情况下,客户端可能会使用任何其他服务器,例如Glassfish或Websphere,在这种情况下,我将无法获取System.getProperty("catalina.base")。我该如何正确解决呢?我可以使用ResourceBundle来做到

java - System.getProperty ("line.separator"之间的区别;和 "\n"?

在使用JavaFX开发GUI时,我似乎在写入过程中使用System.getProperty("line.separator");和"\n"得到了不同的结果文件或从互联网上获取数据。基本上有什么区别? 最佳答案 System.getProperty("line.separator")返回操作系统相关的行分隔符。在Windows上返回"\r\n",在Unix上返回"\n"。因此,如果您想为当前操作系统生成一个带有行尾的文件,请使用System.getProperty("line.separator")或使用PrintWriter编写。

Java System.getProperty( "user.timezone") 不起作用

当我通过java-Duser.timezone="UTC"启动java程序时,System.out.println(System.getProperty("user.timezone"));System.out.println(newDate());//printstimeinUTC打印UTC时间,但是当我设置如下代码时:System.setProperty("user.timezone","UTC");System.out.println(System.getProperty("user.timezone"));//prints'UTC'System.out.println(newD

java - "get' 与 "getProperty"之间的区别

PropertiesmyProp=newProperties();myProp.put("material","steel");Propertiesprop1=newProperties(myProp);System.out.println(prop1.get("material")+","+prop1.getProperty("material"));//outputs"null,steel"在返回条目/属性的意义上,它与getProperty不相似一个东西?为什么在使用get时不返回“钢”? 最佳答案 get继承自Hashtab

c# - Xamarin PCL 中缺少 Type.GetProperties()

在XamarinPCL中,我试图获取我编写的类的System.Reflection.PropertyInfo,以便我可以通过其字符串名称访问其属性以获取/设置,并且缺少Type.GetTypeInfo(),以及Type.GetProperties。但是System.Reflection.PropertyInfo是一个有效的类。如何获取类的属性信息?我是否必须为每个平台编写一个包装器?(它在Android/iOS项目中显示得很好)。 最佳答案 这是一个扩展,所以你需要把usingSystem.Reflection;在顶部。然后它可用:

c# - Xamarin PCL 中缺少 Type.GetProperties()

在XamarinPCL中,我试图获取我编写的类的System.Reflection.PropertyInfo,以便我可以通过其字符串名称访问其属性以获取/设置,并且缺少Type.GetTypeInfo(),以及Type.GetProperties。但是System.Reflection.PropertyInfo是一个有效的类。如何获取类的属性信息?我是否必须为每个平台编写一个包装器?(它在Android/iOS项目中显示得很好)。 最佳答案 这是一个扩展,所以你需要把usingSystem.Reflection;在顶部。然后它可用: