AddConstructor() public method

public AddConstructor ( ) : Constructor
return NClass.Core.Constructor
Beispiel #1
0
        static JavaLanguage( )
        {
            string[] objectMethods = { "protected Object clone()", "public boolean equals(Object obj)", "protected void finalize()", "public final Class getClass()", "public int hashCode()", "public final void notify()", "public final void notifyAll()", "public String toString()", "public final void wait()", "public final void wait(long timeout)", "public final void wait(long timeout, int nanos)" };
            ObjectClass = new JavaClass("Object");
            ObjectClass.AddConstructor( );
            foreach (string methodDeclaration in objectMethods)
            {
                ObjectClass.AddMethod( ).InitFromString(methodDeclaration);
            }

            // validAccessModifiers initialization
            validAccessModifiers = new Dictionary <AccessModifier, string>(4);
            validAccessModifiers.Add(AccessModifier.Default, "Default");
            validAccessModifiers.Add(AccessModifier.Public, "Public");
            validAccessModifiers.Add(AccessModifier.Protected, "Protected");
            validAccessModifiers.Add(AccessModifier.Private, "Private");

            // validClassModifiers initialization
            validClassModifiers = new Dictionary <ClassModifier, string>(3);
            validClassModifiers.Add(ClassModifier.Abstract, "Abstract");
            validClassModifiers.Add(ClassModifier.Sealed, "Final");
            validClassModifiers.Add(ClassModifier.Static, "Static");

            // validFieldModifiers initialization
            validFieldModifiers = new Dictionary <FieldModifier, string>(3);
            validFieldModifiers.Add(FieldModifier.Static, "Static");
            validFieldModifiers.Add(FieldModifier.Readonly, "Final");
            validFieldModifiers.Add(FieldModifier.Volatile, "Volatile");

            // validOperationModifiers initialization
            validOperationModifiers = new Dictionary <OperationModifier, string>(3);
            validOperationModifiers.Add(OperationModifier.Static, "Static");
            validOperationModifiers.Add(OperationModifier.Abstract, "Abstract");
            validOperationModifiers.Add(OperationModifier.Sealed, "Final");
        }
Beispiel #2
0
		static JavaLanguage()
		{
			string[] objectMethods = {
				"protected Object clone()",
				"public boolean equals(Object obj)",
				"protected void finalize()",
				"public final Class getClass()",
				"public int hashCode()",
				"public final void notify()",
				"public final void notifyAll()",
				"public String toString()",
				"public final void wait()",
				"public final void wait(long timeout)",
				"public final void wait(long timeout, int nanos)"
			};
			objectClass = new JavaClass("Object");
			objectClass.AddConstructor();
			foreach (string methodDeclaration in objectMethods)
				objectClass.AddMethod().InitFromString(methodDeclaration);

			// validAccessModifiers initialization
			validAccessModifiers = new Dictionary<AccessModifier, string>(4);
			validAccessModifiers.Add(AccessModifier.Default, "Default");
			validAccessModifiers.Add(AccessModifier.Public, "Public");
			validAccessModifiers.Add(AccessModifier.Protected, "Protected");
			validAccessModifiers.Add(AccessModifier.Private, "Private");

			// validClassModifiers initialization
			validClassModifiers = new Dictionary<ClassModifier, string>(3);
			validClassModifiers.Add(ClassModifier.Abstract, "Abstract");
			validClassModifiers.Add(ClassModifier.Sealed, "Final");
			validClassModifiers.Add(ClassModifier.Static, "Static");

			// validFieldModifiers initialization
			validFieldModifiers = new Dictionary<FieldModifier, string>(3);
			validFieldModifiers.Add(FieldModifier.Static, "Static");
			validFieldModifiers.Add(FieldModifier.Readonly, "Final");
			validFieldModifiers.Add(FieldModifier.Volatile, "Volatile");

			// validOperationModifiers initialization
			validOperationModifiers = new Dictionary<OperationModifier, string>(3);
			validOperationModifiers.Add(OperationModifier.Static, "Static");
			validOperationModifiers.Add(OperationModifier.Abstract, "Abstract");
			validOperationModifiers.Add(OperationModifier.Sealed, "Final");
		}