Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java')
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java47
1 files changed, 45 insertions, 2 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
index 51bc4dd843..ea2565fc24 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/java/source/SourceType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -36,7 +36,7 @@ import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.common.utility.internal.iterables.TreeIterable;
/**
- * Java source type
+ * Java source type (type or interface)
*/
final class SourceType
extends SourceAbstractType<Type>
@@ -49,6 +49,8 @@ final class SourceType
private boolean hasNoArgConstructor;
+ private boolean hasPrivateNoArgConstructor;
+
private final Vector<JavaResourceType> types;
private final Vector<JavaResourceEnum> enums;
@@ -113,6 +115,7 @@ final class SourceType
this.superclassQualifiedName = this.buildSuperclassQualifiedName(binding);
this.abstract_ = this.buildAbstract(binding);
this.hasNoArgConstructor = this.buildHasNoArgConstructor(binding);
+ this.hasPrivateNoArgConstructor = this.buildHasPrivateNoArgConstructor(binding);
this.initializeTypes(astRoot);
this.initializeEnums(astRoot);
this.initializeFields(astRoot);
@@ -129,6 +132,7 @@ final class SourceType
this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(binding));
this.syncAbstract(this.buildAbstract(binding));
this.syncHasNoArgConstructor(this.buildHasNoArgConstructor(binding));
+ this.syncHasPrivateNoArgConstructor(this.buildHasPrivateNoArgConstructor(binding));
this.syncTypes(astRoot);
this.syncEnums(astRoot);
this.syncFields(astRoot);
@@ -236,6 +240,26 @@ final class SourceType
return null;
}
+ // ***** private no-arg constructor
+ public boolean hasPrivateNoArgConstructor() {
+ return this.hasPrivateNoArgConstructor;
+ }
+
+ private void syncHasPrivateNoArgConstructor(boolean astHasPrivateNoArgConstructor) {
+ boolean old = this.hasPrivateNoArgConstructor;
+ this.hasPrivateNoArgConstructor = astHasPrivateNoArgConstructor;
+ this.firePropertyChanged(PRIVATE_NO_ARG_CONSTRUCTOR_PROPERTY, old, astHasPrivateNoArgConstructor);
+ }
+
+ private boolean buildHasPrivateNoArgConstructor(ITypeBinding binding) {
+ return (binding == null) ? false : typeHasPrivateNoArgConstructor(binding);
+ }
+
+ protected static boolean typeHasPrivateNoArgConstructor(ITypeBinding binding) {
+ IMethodBinding method = findNoArgConstructor(binding);
+ return (method != null) && Modifier.isPrivate(method.getModifiers());
+ }
+
// ********** types **********
public Iterable<JavaResourceType> getTypes() {
@@ -485,4 +509,23 @@ final class SourceType
private JavaResourceMethod buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) {
return SourceMethod.newInstance(this, this.annotatedElement, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
}
+
+
+ public boolean hasAnyAnnotatedFields() {
+ for (JavaResourceField field : this.getFields()) {
+ if (field.isAnnotated()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean hasAnyAnnotatedMethods() {
+ for (JavaResourceMethod method : this.getMethods()) {
+ if (method.isAnnotated()) {
+ return true;
+ }
+ }
+ return false;
+ }
}

Back to the top