Tag: 扩展

在eclipse中运行Java app时如何避免glob扩展

我遇到了Eclipse运行配置的特殊行为,它似乎只是一个Windows问题。 假设我有一个打印出命令行参数的Java应用程序,如下所示: public class WildCard { public static void main(String[] args) { for (String arg: args) { System.out.println(arg); } } } 如果我使用可以由shell扩展的外卡提供参数,shell将展开它并将其提供给Java程序。 这并不奇怪。 所以,如果我在命令提示符下做 java WildCard test/* 该程序将打印 test/foo.txt test/bar.txt 其中foo.txt和bar.txt是目录“test”中的文件。 如果我用引号括起通配符参数,可以防止Shell扩展; * nix上的单引号,以及Windows上的双引号。 因此对于Windows,如果我在命令提示符下执行以下操作: java WildCard “test/*” 该程序现在将打印 test/* (没有扩张)。 但是,我发现Eclipse运行启动程序中的引用似乎没有效果,并且参数仍在扩展。 如果我放 “test/*” 在Eclipse运行启动程序的程序参数部分,并运行上面的类,我仍然得到 test/foo.txt test/bar.txt 换句话说,当程序实际运行时,双引号似乎丢失了。 这似乎只发生在Windows上。 有没有办法在Windows上使用Eclipse运行启动程序阻止glob扩展?

Java – 通过对象数组在扩展类中调用函数

我有一个对象数组,其中一些使用扩展版本,其中包含基类中没有的函数。 当数组由基类定义时,如何通过数组调用该函数? 例 Shape[] shapes = new Shape[10]; shapes[0] = new Circle(10) //10 == radius, only exists in circle class which extends Shape shapes[0].getRadius(); //Gives me a compilation error as getRadius() doesn’t exist in the Shape class, only in the extended Circle class. Is there a way around this?

如何使用普通的java api更改RTC流和组件所有权?

我需要更改组件和流的所有权。 我试图找到任何API。 请帮忙。 在这里,我有一个代码片段,但我不知道它将如何工作。 IScmService scmService = null; IRepositoryItemService itemService; IComponentHandle componentH; ComponentOwnerHandle componentOwnerH = scmService.getComponentOwnerRecord((ComponentHandle) componentH); ComponentOwner componentOwner = (ComponentOwner) itemService.fetchItem(componentOwnerH, IRepositoryRemoteService.COMPLETE); IAuditableHandle ownerH = componentOwner.getOwner(); if (componentHandle == null) { // Rename component componentHandle = wm.createComponent(componentName, teamRepository.loggedInContributor(), monitor); wm.setComponentOwner(componentHandle, ownerH, monitor); } else { // Rename component wm.renameComponent(componentHandle, componentName, monitor); wm.setComponentOwner(componentHandle, ownerH, monitor); […]

使用与SomeAbstract

我正在从DotNet转向java,这种扩展的想法是新的。 我看过一些post,完全解释使用List List vs. List List vs. List ,但我猜测在generics中使用和不使用扩展之间没有区别。 真的吗? 如果使用抽象类作为父级,答案会改变吗? class My_AbstractExtends 与 class My_Abstract 编辑 按如下方式创建子类 class My_ChildExtends extends My_AbstractExtends 与 class My_Child extends My_Abstract

java中的通用超类

是否有可能在java中创建这样的东西 public abstract class GenericView extends LAYOUTTYPE 以便 public class MyView extends GenericView 扩展GenericView和HorizontalLayout和 public class MyView2 extends GenericView 扩展GenericView和VerticalLayout ?

在运行时扩展类

所以对于这个项目,我试图在运行时扩展一个类。 我想知道的是,这甚至可能吗? 如果是这样,我该怎么做? 那些东西有没有图书馆?

回归collections vs Collection

这两种方法有什么区别? Collection getTypes(); VS Collection getTypes(); 如果Type是类或接口,这是否重要? 特别是,在设计API时,首选哪个版本以及为什么?

Java – 使用’super’关键字

简单的问题。 我创建了一个名为Tester1的类,它扩展了另一个名为Tester2的类。 Tester2包含一个名为’ABC’的公共字符串。 这是Tester1: public class Tester1 extends Tester2 { public Tester1() { ABC = “Hello”; } } 如果我改为第5行 super.ABC = “Hello”; 我还在做同样的事吗?

Java:扩展内部类

我试图理解在Java中扩展内部类。 我已经阅读过,但没有找到我的问题。 所以这里…… 我有… public class Pie{ protected Slice[] slices; // Pie constructor public Pie(int n){ sliceGenerator(n) } private void sliceGenerator(int n){ slices = new Slice[n]; final float sweepAngle = 360.0f/(float)n; float startAngle = 0; for (int i=0;i<n;i++){ slices[i] = new Slice(startAngle); startAngle += sweepAngle; } } @Override public String toString(){ for (Slice s:slices){ s.toString(); […]

在Java类型参数中,仅指严格的亚型? 还是E也足够了?

在Java类型参数中,是否仅指严格的子类型? 还是E也足够了?