Thus, you should never have a no-argument constructor for an immutable class.
因此,您永远都不该为一个不可变类提供一个无参数的构造函数。
Adding a constructor or two for each exception class rarely takes more than a few minutes per exception.
对于一个异常,为每个异常类添加一个或两个构造器,所花费时间很少不超过几分钟。
For instance, any class representing a non-empty container would naturally take arguments representing its elements in the constructor.
例如,表示非空容器的任何类在构造函数中必然使用表示其元素的参数。
The most important thing to note when extending JAAS for class instance-level authorization is that the permission implementation class must have a three-parameter constructor.
在为类实例级授权扩展JAAS时要注意的最重要的一点是:许可权实现类必须有一个带三个参数的构造函数。
For classes with few constructor arguments or if you are creating many objects of the same class, this is viable but soon becomes untidy for classes whose constructors have lots of arguments.
对于带有少数几个构造方法参数的类,或者如果您正创建同一个类的多个方法,这是可行的,但是对于构造方法具有大量参数的类来说,很快就会变得杂乱无章。
This instantiation involves the default constructor for the class being called, with the injection of dependencies happening afterwards.
这种实例化涉及到要调用的类的默认构造函数,随后还要注入依赖关系。
Constructor provides the name for the Class and initializes the properties which can be different in every instance of the Class.
构造器会为类提供一个名称,和初始化每一个类的实现的属性。
These classes define methods for modifying all aspects of the item represented by the class, including the actual bytecode body of a method or constructor.
这些类定义了修改由它们所表示的对象的所有方法的方法,包括方法或者构造函数中的实际字节码内容。
Let's start with the constructor for the handler class (see Listing 3) to see the how the page has been retrofitted for localization.
让我们从处理程序类的构造函数开始(参见清单3)来看看如何为本地化翻新页面。
This type actually defines the signature of a constructor for the specified class and a matching sequence of values.
该类型实际定义了指定用于类和值的匹配序列的构造器的签名。
Notice that the class name matches the filename, and that you have to have a constructor for your class.
请注意,类名与文件名匹配,必须为类提供一个构造函数。
The constructor of the class extracts the JNDI name and the unique key, and then checks the Distributed Map for the data.
这个类的构造函数提取JNDI名和唯一密钥,并检查分布式映射缓存中的数据。
The first method is one that doesn't even appear in the source code for my template class back in Listing 1, the default constructor for the class.
清单1中的模板类源代码是类的默认构造函数,第一个方法没有出现在其中。
You do not code a class definition for them, nor do you call a constructor to create them.
不能通过代码为SDO编写一个类定义,也不能调用构造函数来创建它们。
For example, you could initialize such resources in the constructor of the SubTask class.
例如,您可以在subtask类的构造函数中初始化这类资源。
Note that method changes to the class are irrelevant to db4o because it doesn't store methods or method implementations as part of the stored object data, and ditto for constructor refactorings.
注意,对类中方法的更改与db4o无关,因为它不将方法或方法实现作为存储的对象数据的一部分,对于构造函数的重构也是如此。
It might be that the whole trait should actually be a class instead, so you can define a constructor for it that initializes the field.
这样也许应该说这整个trait实际上应该是一个类,这样你才能定义一个构造函数来初始化这个字段。
In line 14, a test case must have a single string parameter constructor that passes the argument to its parent class (TestCase) for the purpose of displaying the test case name in a log.
在第十四行中,为了在日志中显示这个测试用例的名称,一个测试用例必须有一个可以将自变量传递到它的父类(TestCase)的专门的串参数构造器。
To demonstrate how coverage tracking works, I'm going to go back to the constructor for the StringArray class I've used throughout this article.
为了演示复盖跟踪的工作原理,我将重新把目光投向我在本文中使用的stringarray类的构造函数。
This constructor lets you specify the priority, memory sizes, and period for a thread, along with the class that represents the thread to be run (a class that extends PeriodicThread).
此构造函数让您能够指定优先级、内存大小、线程周期和表示要运行的线程的类(扩展periodicthread的类)。
The constructor for the file_lock class accepts the name of the file to be locked, and it's important to open the file before lock is invoked; otherwise, an exception will be thrown.
file_lock类的构造函数接受要锁定的文件的名称,一定要在调用lock之前打开文件;否则会抛出异常。
Figure 1 shows a constructor with two arguments of type Point and a destructor modeled for the DrawingSurface class of the sample application used here for illustration purposes.
图1展示了为示例应用程序(在这里用于举例)的drawingsurface类建模的带有两个Point类型参数的构造方法和一个析构方法。
The field class itself is pretty simple; it pretty much consists of the instance variables of the field, accessor methods for those instance variables, a toString method, and a normal constructor.
Field类本身相当简单;它几乎包含了这个字段的实例变量,访问这些变量的方法,一个toString方法,和一个标准的构造方法。
For details on how each instance variable is computed, you can look at the constructor method for the class where all these values are derived.
关于如何计算每个实例变量的详细信息,可以查阅该类的构造函数方法,所有这些值都源自那里。
You can just use a constructor for the appropriate class directly, without going through a factory class.
可以仅仅直接使用相应类的构造函数,而不用通过工厂类。
There are two tests displayed; the first represents the successful execution of the constructor for our class, and the second is the execution of the actual method call.
这里显示了两个测试:第一个展示了类构造器的成功执行,第二个是真实方法调用的执行。
The constructor and destructor of the queue class are responsible for the creation and destruction of the mutex, as shown in Listing 1.
队列类的构造函数和析构函数负责创建和销毁互斥锁,见清单1。
As for followpos , I have added an accessor and new code in the class constructor.
至于followpos,我在类构造器中添加了一个取值(方法)和新代码。
To avoid this problem, you can create an interface (for example, Vehicle) and have your FrogMan class accept the Vehicle as a constructor argument, as in Listing 3.
为了避免这个问题,您可以创建一个接口(例如vehicle),使frogman类接受Vehicle作为一个构造函数参数,如清单3所示。
To avoid this problem, you can create an interface (for example, Vehicle) and have your FrogMan class accept the Vehicle as a constructor argument, as in Listing 3.
为了避免这个问题,您可以创建一个接口(例如vehicle),使frogman类接受Vehicle作为一个构造函数参数,如清单3所示。
应用推荐