Eclipse fails to auto-suggest Jackson class - eclipse

What is causing Eclipse to NOT recognize and consequently not offer any suggestion on an import of JsonParser.Feature as shown in the picture below:
Manually adding the static import of com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_SINGLE_QUOTES (commented in the picture above), however, works fine.
Would it be the case that something is eclipsing the file on the classpath, and if so - what is Eclipse's strategy on resolving those conflicts? Or is it something else?
Thank you in advance.

You cannot use JsonParser class to access Feature since it is not a static member of the class. Instead you can directly use the Feature class :
mapper.configure(Feature.ALLOW_SINGLE_QUOTES, true);

I can suggest 2 workarounds:
Use AutoComplete (Ctrl + Space) to suggest classes:
Add . to class Name (JsonParser.) and then remove it (JsonParser) it will suggest all JsonParser classes:

Related

what is the reason for menuitem error in flutter

In my project there is an error occurs
The name 'MenuItem' is defined in the libraries
'package:emarket_user/view/base/mars_menu_bar.dart' and
'package:flutter/src/widgets/platform_menu_bar.dart'.
(ambiguous_import at [emarket_user] lib\view\base\menu_bar.dart:10)
please help me to solve this
The class MenuItem is an abstract class for describing cascading menu hierarchies that are part of a [PlatformMenuBar] package.
in the second line import you're importing this class in this line:
import 'package:flutter/src/widgets/platform_menu_bar.dart';
but in this line 'package:emarket_user/view/base/mars_menu_bar.dart' you are importing from a library or class that you wrote, maybe you have wrote it and then delete it or renaming without refactoring it. try to remove that line of import or change the class name in platform_menu_bar.dart.

Name property in #ManagedBean annotation is not available

I am trying to make my first JSF application with help of youtube tutorial video. (eclipse/JSF2.0 Dynamic web project). In the first class created, I have to add the below line
#ManagedBean (name = "userRegistration")
But, when I did the same, eclipse shows an error on "name" keyword and giving suggestion to replace it with "value".
#ManagedBean (value = "userRegistration")
But it is not working as expected and threw below error.
/FirstPage.xhtml #10,66 value="#{userRegistration.name}": Target Unreachable, identifier 'userRegistration' resolved to null
Can anyone please help me here?
#ManagedBean(name="userRegistration") is correct. You can avoid (name="userRegistration") part if your java class is UserRegistration. Check if you have imported proper class: java.faces.bean.ManagedBean
Piggy backing on previous answer, I just had this problem as well. Make sure you have the correct import. There are 2 imports that have the #ManagedBean annotation.
javax.annotation.ManagedBean & javax.faces.bean.ManagedBean
javax.annotation.ManagedBean does not have the attribute name, or eager for that matter.
I noticed that if I just annotated my bean class with #annotation that it would import the javax.annotation.ManagedBean class and not the faces one that I wanted.

What to import to use Lift's FieldTransform

I just started using Lift's Wizard/LiftScreen classes and need to add placeholder text to my text fields. I found the FieldTransform class as a solution to this here
https://groups.google.com/forum/#!topic/liftweb/x_t9rvvZ8jk and here http://comments.gmane.org/gmane.comp.web.lift/59985
But now I'm trying to use that information, but can't for the life of me figure out what import statement is needed (where the class is, in the libraries).
Lift 2.5-M3 talks about the API changing liftweb.net/25_m3, but nowhere do I find the class actually listed in the API (liftweb.net/api/25/api/#package).
What's the import I need? How should I be looking this up; I'd like to know how to find a class quickly next time.
EDIT:
To be a good Stackoverflow citizen, here's some code.. :-)
object WizardExample extends Wizard {
val screen1BrandInfo = new Screen {
val brandName = field("Name", "Mike")
}
}
I'm trying to add HTML5 placeholder text to the "Name" field so the user sees sample text when they view the page.
RESOLUTION:
Wow, that was my first StackOverflow. I'm blown away by what I've learned from you guys in a few hours!
#jcern: thanks for all your help. I'm working in Lift 2.4, so initially I didn't find FieldTransform in Wizard$Screen, then I clicked on the link you provided (2.5) and saw it. What a jungle to navigate! Thanks for all your help. I now see how to navigate all this. And thanks again so much for the "All" view hint. That was critical!
#Vasya Novikov: Thanks so much for this answer. This is what I'll have to do since I'm working in 2.4 and don't have access to FieldTransform.
The two best places to find classes in Lift are either in the API:
http://liftweb.net/api/25/api/#package
Or, directly in GitHub (where you can search for classes and for text/definitions within them):
https://github.com/lift/framework
As for the FieldTransform class, that should be available to any class that extends LiftScreen. See the API here -- you may need to toggle the visibility to All to see FieldTransform as it is a protected class.
You can import LiftScreen with:
import net.liftweb.http.LiftScreen

Duplicate interface definition for class SBJsonBase?

I added the Facebook sdk code to my project then I got this error because I already had a json library, so I deleted the Facebook json library from my computer and from the project but I still get this error. I search the whole project for "#interface SBJsonBase" and I only get one result. How can it say it's a duplicate when I only have one interface? Is it including the file twice? Does the search not always find everything?
May be this helps? Delete your derived data and do a clean project, then try to build again
I had a simular problem. It was a small search, but I could solve it without creating a new project etc...
The thing was I had a Class B that was importing Class A.
Then I had a class that imported Class B and also Class A.
When I did this, these problems occured.
Eg. A SOAP webservice Class imports all the Entities that are passed over the web.
Class goToSchoolWebservice.
import "person.h"
import "school.h"
...
Then I had a Singleton class used for caching that had the Logged in Person and also a ref to the webservice class.
import "person.h"
import "goToSchoolWebservice.h"
--> this is where is went wrong!!
So watch out for these circular references. ITs not so easy to detect them!
if your using #include instead of import then use this technique to minimize duplicates: at the begining of your interface (actually right before it) do check for a definition and if not defined then define it and proceed to define your interface. here is an example:
#ifndef __NetworkOptionsViewController__H // check if this has every been imported before
#define __NetworkOptionsViewController__H
#import "blahblah.h"
#interface NetworkOptionsViewController : UITableViewController
{
NSMutableArray* somevariable1;
int somevariable2;
}
#end
#endif
-- for me personally, i got this error though because the file path to my class was wrong. I checked file inspector and my class file was not defined in Classes folder even though the IDE said it was. I deleted them and copied them over again.
For those that still get this error, despite following header import conventions: I got this error from importing a header that had been deleted from the project. The missing header was instead found in an old backup of my project in dropbox (That I made before doing some destructive stuff in Git), and that file caused the circular import.
I solved a similar problem by moving all the imports to the prefix header file.

Using Lambdaj to Navigate Through Dom4j Elements

For anyone familiar with lambdaj (not I) you will have seen this stacktrace, or some variation, before:
ch.lambdaj.function.argument.ArgumentConversionException: Unable to
convert the placeholder org.dom4j.tree.AbstractAttribute in a valid
argument at
ch.lambdaj.function.argument.ArgumentsFactory.actualArgument(ArgumentsFactory.java:92)
at
ch.lambdaj.function.matcher.HasArgumentWithValue.havingValue(HasArgumentWithValue.java:70)
at ch.lambdaj.Lambda.having(Lambda.java:1204)
My understadning is that this happens through a limitation of lambdaj with final classes.
I get the above when testing the following code:
import static ch.lambdaj.Lambda.having;
import static ch.lambdaj.Lambda.selectFirst;
import static org.hamcrest.CoreMatchers.equalTo;
import java.util.List;
import org.dom4j.tree.AbstractAttribute;
public class DocumentUtils {
public static String getAttributeValueFromListByName(
List<AbstractAttribute> list, String name) {
AbstractAttribute requiredAttribute = selectFirst(list,
having((AbstractAttribute.class).getName(), equalTo(name)));
String value = requiredAttribute.getValue();
return value;
}
}
I had been using dom4j's Attribute interface, getting the same problem, then thought maybe lambdaj doesn't like interfaces.. so I switched to the AbstractAttribute abstract class.
Is there an issue with lambdaj and abstract classes? Or is my method just pants? Any ideas how to solve this?
FYI: I'm using lambdaj 2.4 and dom4j 1.6
Thanks a lot in advance.
If you're using lambdaj 2.4 you're lucky because this issue has been fixed in that release. The problem and its solution is described in the first point of the release notes of lambdaj 2.4.
In particular lambdaj uses an internal heuristic to create Argument's placeholder, but it doesn't work in some cases, so you can override it as explained there.
Issue 92 has been raised with lambdaj, as requested by Mario Fusco (LambdaJ Developer)