asbachb commented on code in PR #5970:
URL: https://github.com/apache/netbeans/pull/5970#discussion_r1199622150


##########
enterprise/j2ee.core/src/org/netbeans/api/j2ee/core/Profile.java:
##########
@@ -140,134 +123,23 @@ public String toString() {
 
     @CheckForNull
     public static Profile fromPropertiesString(@NullAllowed String value) {
-        String valueMinusQuotes = value;
-        if(value != null && value.contains("\"")){
-            valueMinusQuotes = value.replace("\"","");
-        }
-        if (J2EE_13.toPropertiesString().equals(valueMinusQuotes)) {
-            return J2EE_13;
-        } else if (J2EE_14.toPropertiesString().equals(valueMinusQuotes)) {
-            return J2EE_14;
-        } else if (JAVA_EE_5.toPropertiesString().equals(valueMinusQuotes)) {
-            return JAVA_EE_5;
-        } else if (JAVA_EE_6_FULL.toPropertiesString().equals(valueMinusQuotes)
-                || "EE_6_FULL".equals(value)){ // NOI18N
-            return JAVA_EE_6_FULL;
-        } else if (JAVA_EE_6_WEB.toPropertiesString().equals(valueMinusQuotes)
-                || "EE_6_WEB".equals(value)) {
-            return JAVA_EE_6_WEB;
-        } else if (JAVA_EE_7_FULL.toPropertiesString().equals(valueMinusQuotes)
-                || "EE_7_FULL".equals(value)) { // NOI18N
-            return JAVA_EE_7_FULL;
-        } else if (JAVA_EE_7_WEB.toPropertiesString().equals(valueMinusQuotes)
-                || "EE_7_WEB".equals(value)) {
-            return JAVA_EE_7_WEB;
-        } else if (JAVA_EE_8_FULL.toPropertiesString().equals(valueMinusQuotes)
-                || "EE_8_FULL".equals(value)) { // NOI18N
-            return JAVA_EE_8_FULL;
-        } else if (JAVA_EE_8_WEB.toPropertiesString().equals(valueMinusQuotes)
-                || "EE_8_WEB".equals(value)) {
-            return JAVA_EE_8_WEB;
-        } else if 
(JAKARTA_EE_8_FULL.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_8_FULL".equals(value)) {
-            return JAKARTA_EE_8_FULL;
-        } else if 
(JAKARTA_EE_8_WEB.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_8_WEB".equals(value)) {
-            return JAKARTA_EE_8_WEB;
-        } else if 
(JAKARTA_EE_9_FULL.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_9_FULL".equals(value)) {
-            return JAKARTA_EE_9_FULL;
-        } else if 
(JAKARTA_EE_9_WEB.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_9_WEB".equals(value)) {
-            return JAKARTA_EE_9_WEB;
-        } else if 
(JAKARTA_EE_9_1_FULL.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_9_1_FULL".equals(value)) {
-            return JAKARTA_EE_9_1_FULL;
-        } else if 
(JAKARTA_EE_9_1_WEB.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_9_1_WEB".equals(value)) {
-            return JAKARTA_EE_9_1_WEB;
-        } else if 
(JAKARTA_EE_10_FULL.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_10_FULL".equals(value)) {
-            return JAKARTA_EE_10_FULL;
-        } else if 
(JAKARTA_EE_10_WEB.toPropertiesString().equals(valueMinusQuotes)
-                || "JAKARTA_EE_10_WEB".equals(value)) {
-            return JAKARTA_EE_10_WEB;
-        } else {
-          return null;
+        if (value == null) {
+            return null;
         }
-    }
-
-    private static String getProfileVersion(@NonNull Profile profile) {
-        String profileDetails = profile.toPropertiesString();
-        int indexOfDash = profileDetails.indexOf("-");
-        if (indexOfDash != -1) {
-            return profileDetails.substring(0, indexOfDash);
-        }
-        return profileDetails;
-    }
 
-    private static boolean compareWebAndFull(@NonNull Profile 
profileToCompare, @NonNull Profile comparingVersion) {
-        boolean isThisFullProfile = isFullProfile(profileToCompare);
-        boolean isParamFullProfile = isFullProfile(comparingVersion);
-        if (isThisFullProfile && isParamFullProfile) {
-            // Both profiles are Java EE Full
-            return true;
-        }
-        if (!isThisFullProfile && !isParamFullProfile) {
-            // Both profiles are Java EE Web
-            return true;
-        }
-        if (isThisFullProfile && !isParamFullProfile) {
-            // profileToCompare is Java EE Full profile and comparingVersion 
is only Java EEWeb profile
-            return true;
-        }
-        return false;
-    }
-
-    private static boolean isFullProfile(@NonNull Profile profile) {
-        final String profileDetails = profile.toPropertiesString();
-        if (profileDetails.indexOf("-") == -1) {
-            return true;
+        String valueMinusQuotes = value;
+        if(value.contains("\"")){
+            valueMinusQuotes = value.replace("\"","");
         }

Review Comment:
   Good idea.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to