Parsing a List of Pojos

Hello Java experts,
A questions for you regarding pojos in a List.
I have a pojo called 'Role' which has 2 instance variables - int Count and String RoleType. I have a List of Roles, which I want to parse to find out if a particular RoleType is present in my list.
List<Roles> roleList = new ArrayList<Roles>();
What method if any can I use to find out if the RoleType, say 'Admin' is present in my roleList? If this was a List<String> I could have used the contains() or indexOf() method to do this. I am stumped as it is a list of pojos.
Any ideas will be much appreciated!
Thanks in advance.

What method if any can I use to find out if the RoleType, say 'Admin' is present in my roleList? If this was a List<String> I could have used the contains() or indexOf() method to do this. I am stumped as it is a list of pojos.
Assuming you created your "POJO", just add something like the following to your class
public boolean isAdmin() {
        return roleType.equals("Admin");
}When you are in the loop, just call myPojo.isAdmin().
This is just an idea, you might have change variable names based on your class.
HTH
-t

Similar Messages

  • Error message: Error parsing properties list from memory

    When I try to open my website that I built with Adobe Muse CC in Adobe Muse CC 2014 comes the error message: "error parsing properties list from memory" an everything is stuck, I can't open anything or working not even the preview mod is working, nothing. The same problem/message comes up when I try to star a new site. So I just can't work with the new Adobe Muse CC 2014 (I updated today the new launch). Does anyone know what is going on here? Is it a bug or what?

    This just happened to me. I've had no trouble at all with the latest version of abobe muse until today...Its still working alittle..I can't access sites but not via thumbnail have to click tab. My major issue is the side toolbar not loading.
    Any fix known??

  • After Effects warning: Error parsing properties list.

    Hi all,
    I got this error message today when I got back to work from over the weekend. This is the first time I have seen this error and have had no real luck finding any good fix for it.
    this is the error message:
    After Effects warning: Error parsing properties list.
    I am running Windows XP Professional, Version 2002 Service Pack 2, with AMD Opteron(tm) Processor 250, 2.39GHz, 2.00 GB Ram
    The error message pops up in a small box with the above message, I hit ok to close the box and nothing happens and I double click AE again to open it and it opens with just the top navagation bar and the rest of the window is grey. It does not open completely and If I click anything it crashes. Giving me a message about it can't continue and to contact adobe support for know issues.
    Has anyone had this problem and if so whats the best fix?????
    THANKS so Much in advance!
    David

    Start by quitting After Effects and clearing the entire preferences folder. I.e., delete the entire   /Users/username/Library/Preferences/Adobe/After Effects/12.2/   folder when After Effects is not running.

  • CS3 AE: Error parsing properties list

    Working on a CS3 PPro project, no problems.  Startup up this morning to find all AE clips now read as 'Media Offline' & when I try to open AE it crashes with the following warning: - After Effects: Error Parsing Properties List.  So I tried a few fix it that I could find.  These being in PPro to slecet the entire timeline and move it slightly then Ctrl Z, some indicated fixed the problem, it didn't for me.  So then I followed Todd K's advice (http://blogs.adobe.com/toddkopriva/2009/02/crash_on_start_with_error_pars.html) but this doesn't work either.  I tried to reinstall AE but I still get a crash, how do I fix this?

    Thanks Mylenium,
    What an unpleasant experience that was.  Took you're advise but still had error so Kumal at Tech Support was able to push me over the edge and thangs aren't crashing no more.  I had to :-
    Add/Remove Programs - remove CS3
    run cs3 cleanscript choosing 'secret option' # 4, there are only two options 1 & 2 shown onscreen.  Then reinstall, problem fixed.  Thank you, thank you, thank you

  • How to parse directory listing

    hey guys
    id like to create fully directory listing of my usb-hdd and parse this listing directly into a textfile
    i know this should be done with terminal but i dont know how and google just showed some weird results to terminal usage in general, like how to make a directory or how to change the directory
    thanks in advance

    okay i actually figured out how to do that thingy and it gives me an input/output error with two files
    but these two files on the hdd which just wont let themselves be deleted with rm "bla bla" terminal gives me a input/output error and manually deleting is no option either
    oh and cmd under windows tells me to perform chkdsk on my hdd because of these two files
    what is this?

  • AE crashed with Error:parsing properties list!

    I work with After Effects CS4 on Windows 7 .64. The problem is: when startin AE crashed with Error:parsing properties list! Help! I have read all about this error in other version of Windows and EA. But what to do in this case? Deleting all .xml files? I have tried to delete even  dir c:\users\user_name\AdobeCS4. No result. The same error...

    I use Windows 7 and the problem is
    1)There is no such directory
    2) there is no file AIFeffectsChash.xml^

  • Syntax Error with JSON.Parse method to parse SharePoint List Items

    Hi All,
    I want to get SharePoint List data and bind that retrived data to the JQuery Grid Control.
    For this I used SPServices to get the SharePoint List data in SOAP Envelope. Now I need to parse the soap envelope and store the retrieved items in array to pass it to the Grid Control.
    While using the JSON.Parse(resporseText) method, Iam consistenly getting an Syntax Error!
    Could anyone help me with this ?
    Please find the SOAP Envelope I received from SP List as below:
    "<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
    xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
    xmlns:rs='urn:schemas-microsoft-com:rowset'
    xmlns:z='#RowsetSchema'>
    <rs:data ItemCount="2">
    <z:row ows_OBNumber='112211.000000000' ows_Project_x0020_Name='Project 1' ows_MetaInfo='11;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='Project 1' ows_ID='11' ows_UniqueId='11;#{FBBCBCF9-666D-42F9-92D7-67188C51BC9B}' ows_owshiddenversion='1' ows_FSObjType='11;#0' ows_Created='2015-01-12 10:25:06' ows_PermMask='0x7fffffffffffffff' ows_Modified='2015-01-12 10:25:06' ows_FileRef='11;#sites/Lists/Projects/11_.000' />
    <z:row ows_OBNumber='1122343.00000000' ows_Project_x0020_Name='Project 2 ' ows_MetaInfo='12;#' ows__ModerationStatus='0' ows__Level='1' ows_Title='Project 2' ows_ID='12' ows_UniqueId='12;#{0D772B76-68E4-4769-B6FF-6A269F9C7ABD}' ows_owshiddenversion='1' ows_FSObjType='12;#0' ows_Created='2015-01-12 10:33:48' ows_PermMask='0x7fffffffffffffff' ows_Modified='2015-01-12 10:33:48' ows_FileRef='12;#sites/Lists/Projects/12_.000' />
    </rs:data>
    </listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope>"
    Any help on this will be greatly appreciated.
    Thanks In Advance.!

    Hi,
    According to your description, there is an issue when parsing result from the data retrieved using SPServices.
    By default, SPServices returns data as XML format, however, the JSON.parse() method “Throws a SyntaxError exception if the string to parse is not valid JSON”:
    https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
    To extract the data needed from the response, you can either take the demo below for as a reference:
    http://spservices.codeplex.com/wikipage?title=GetListItems
    Or use the jQuery.parseXML() function:
    http://api.jquery.com/jquery.parsexml/
    Best regards
    Patrick Liang
    TechNet Community Support

  • Can't figure out how to parse JSON list of lists into a table

    JSON returned (from google analytics) has an entry like:
    "rows": [
            "(none)",
            "148"
            "email",
            "2"
            "organic",
            "183"
            "referral",
            "140"
    In Power Query the column heading is "List" and each row has "List" which I can drill into. But I need to instead expand this into a table with 4 rows and 2 columns.

    I thought to transform this JSON into XML Spreadsheet format, but I just did a test and Power Query cannot parse Excel XML Spreadsheet files. Frankly I was surprised that it couldn't read it since it is a native Excel format. 
    If I were to transform my JSON into a format that Power Query can understand and that allows me to specify data types and ideally also formats, what text file formats should I be considering.  XML Spreadsheet is the only text file format I know that
    allows you to specify data types.  But I have a feeling that I am overlooking some other options.
    OData would be great except that Power Query insists on also asking for the metadata in a separate call. It would be great if Power Query could RESTify the OData request by either not making the $metadata request (another argument to the OData function?)
    or just continuing on if that HTTP call failed.

  • JDK 1.5 parser & parser properties listing..

    Hi.
    I'd like to know, which parser is bundled with JDK1.5. Is it still Crimson?
    Also, i am trying to get properties of GNU JAXP dom implementation. Something I am doing wrong, because my app only says, that it supports only Core and XML - modules, and according to their webpage it should support many other modules too.
    I use the following code :
    DocumentBuilderFactory dbf=gnu.xml.dom.JAXPFactory.newInstance();
        try{
        DocumentBuilder b=dbf.newDocumentBuilder();
        DOMImplementation dimpl=b.getDOMImplementation();
        for(int i=0;i<Globals.domFeatures.length;i++)
        if(dimpl.hasFeature(Globals.domFeatures, "2.0"))
    System.out.println ("supports "+Globals.domFeatures[i]);
    else System.out.println(" ** Doesn't support "+Globals.domFeatures[i]);
    for(int i=0;i<Globals.domFeatures.length;i++)
    if(dimpl.hasFeature(Globals.dom3Features[i], "3.0"))
    System.out.println ("supports 3.0 "+Globals.dom3Features[i]);
    else System.out.println(" ** Doesn't support 3.0 "+Globals.dom3Features[i]);
    feature strings are :
    public static String [] domFeatures={"Core","XML","HTML","Views","Stylesheets","CSS","CSS2","Events","UIEvents","MouseEvents",
                "MutationEvents","HTMLEvents","Traversal","Range"};
        public static String [] dom3Features={"Core","XML","LS","LS-Async","xpath","ViewsAndFormatting","VisualViewsAndFormatting","Validation"};

    JDK 5.0 bundles Apache Xerces (close to version 2.6.0 I believe).

  • SelectMany return list of POJO : improve MenuRenderer ?

    I can't figure out why MenuRenderer doesn't use the converter when the model type is a List.
        protected ArrayList<String> handleListCase(FacesContext context,
                                        String[] newValues) {
            int i = 0, len = newValues.length;
            ArrayList<String> result = new ArrayList<String>(len);
            for (i = 0; i < len; i++) {
                result.add(newValues);
    return result;
    It just convert a String array into a String list (BTW why don't you use Arrays.asList( newValues ) ?).
    My suggestion is to use the handleArrayCase method and then convert it into a List.
    handleListCase would become :
    protected List handleListCase(FacesContext context,
                  UISelectMany uiSelectMany,              
                    String[] newValues) {
        return Arrays.asList( (Object[])handleArrayCase(context, uiSelectMany, Object[].class, newValues) );
    }This simple hack would enable us to use all the selectMany tags with List.

    Is there a JIRA for Sun JSF Impl where I could suggest this ?

  • Error parsing properties list from memory

    desde ayer me sale este error, y nome deja hacer casi nada, nomazimiza las pantalals de muestra e inicio, toca hacerlo manualmente desde las pestañas, despues de un rato cuando se logra abrir la de muestr aparece un tono rojiso sobre la imagen como si fuera un velo, y bloque algunas funciones, solo puede pasar de pantalla de muestra a previsualizacion no deja ver la de inicio.

    This just happened to me. I've had no trouble at all with the latest version of abobe muse until today...Its still working alittle..I can't access sites but not via thumbnail have to click tab. My major issue is the side toolbar not loading.
    Any fix known??

  • Parse User Pasted Text and use in SQL query

    I am trying to take some user pasted text (typically would come from Excel) and parse those values and put into a query.
    text area:
    ":P11_text"
    query:
    "select *
    from table
    where column in :P11_text;"
    I have tried some variations of replace and translate in order to parse that list of values...something like: translate(:P11_text, chr(10)||chr(13), ',' ).....and many variations of this.
    I have been able to replace the end of lines with the commas, but it appears that I am not getting my single quotes captured, even when trying to force them in. The best attempt returned single quotes and commas in between values but not at the beginning and end of the list of values.
    I would bet that there is an easy way to accomplish this or an easy way to accomplish the requirement in a different way altogether.
    Please point me in the right direction.

    I finally got this one figured out!
    create or replace type myTableType as table
    of varchar2(4000)
    create or replace
    function in_list( p_string in varchar2 ) return myTableType
    as
    l_string long default p_string || ',';
    l_data myTableType := myTableType();
    n number;
    begin
    loop
    exit when l_string is null;
    n := instr( l_string, ',' );
    l_data.extend;
    l_data(l_data.count) :=
    ltrim( rtrim( substr( l_string, 1, n-1 ) ) );
    l_string := substr( l_string, n+1 );
    end loop;
    return l_data;
    end;
    --The SQL Query is:
    select *
    from t wher c in (select *
    from THE
    ( select cast( in_list(translate(:p10_prolist,chr(10)||chr(13),',')) as
    mytableType ) from dual ) a);
    --Working like a champion!!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Passing a list into a sql procedure via a unix shell.

    9.2.0.6
    for some dumb reason we cannot use java to do this task.
    anyways
    I need to build a list of all file in a particular directory. The list could be zero to very very long. I would like to be able to pass that list to a PL/SQL procedure.
    this is in unix
    I think I could do something like
    var=f1,f2,f3,f4
    sqlplus blah/blah $var
    exec my_proc(&var);
    I guess that would handle up to 32k in length. It would be up to me to parse the list.
    I am really looking for an way to do this a bit slicker.. like with a ref cursor but I seem to be getting stuck.
    Thanks

    Some examples here :
    Re: How to pass Character parameter
    Nicolas.

  • Field containing a list of sizes or a table ?

    Iain was kind enough to advise on using a table instead of a field containing a list of 6 comma separated items.
    I did this, but can I throw a new slant on why I'd prefer to use a field ?
    JEWELLERY WEB PAGE
    select * from merchandise where merchandise.category = "Jewellery"
    PRODUCT DETAIL PAGE
    When a user clicks on any items from above page, the hyperlink sends the unique merchandise_ID in the link, to a product detail page using a new query:
    select * from merchandise where merchandise.merchandise_ID = URL.merch_ID'
    This jewellery comes in various sizes. These sizes were in a comma separated list in a field called 'sizes' in the merchandise table. I'd been advised to move them to a table instead. If I moved the sizes to a separate table I'd have to add a LEFT JOIN to include the sizes table or run a separate query on the sizes table (where sizes.merchandise_ID = URL.merch_ID) - which is a performance hit.
    All I need to do with the sizes is produce a drop down list the user can choose from - so isn't it better I just put the sizes in a single field, separated by commas ? Then use Coldfusions inbuilt functions to parse the list into a drop-down box ?

    A thought experiment that might convince you.
    Lets compare these two data schemas.
    CSV
    Item
    Size
    Shirt
    Small,Medium,Large
    Coat
    Medium,Small,Large
    Pants
    Small,Large,Medium
    Shoes
    Large,Small,Medium
    NORMALIZED
    Size Table
    Key
    Size
    1
    Small
    2
    Medium
    3
    Large
    Item - Size Join Table
    ItemKey
    SizeKey
    1
    1
    1
    2
    1
    3
    2
    1
    2
    2
    2
    3
    3
    1
    3
    2
    3
    3
    4
    1
    4
    2
    4
    3
    Item Table
    Key
    Item
    1
    Shirt
    2
    Coat
    3
    Pants
    4
    Shoes
    Now imagine these two systems extended to multiple thousands of items.
    Then imaging that some marketing type decided that "Large" was an ugly description for that size so they want to change it to "Husky"  and|or they want to change the "Small" size to "Petite".
    In the Normalized version you make one or two updated to the size table.  I don't even want to try and describe the ugly update you have to try and create that involves looping and string manipulations to try and update all the records in the CSV version.

  • Error in getting the List Id in Visual studio Update Lsit item workflow activity

    Hi All,
    I am continuously getting this error 
    RequestorId: 65a82d7b-122b-b5ad-238b-3b7cde25c8aa. Details: System.FormatException: Expected hex 0x in '{0}'. at System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument) at System.Guid.TryParseGuidWithHexPrefix(String
    guidString, GuidResult& result) at System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result) at System.Guid.Parse(String input) at System.Activities.CodeActivity`1.InternalExecute(ActivityInstance instance, ActivityExecutor executor,
    BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation).
    I know that workflow not ale to get my list's guid at run time and  it is a bug which is yet not fixed.
    I have already tried changing
    System.Guid.Parse("{$ListId:Lists/MyList;}") with the list GUID 
    System.Guid.Parse("{75DD48E6-44D3-43B1-BD83-D836CDE04FB9}").
    and this blog
    sp2013workflows.blogspot.ru/.../lookup-activities-in-visual-studio-2012.html
    but still workflows not working.
    any other option can i try?

    Hi Alok,
    Thanks for sharing ! It will help others who stuck with the same issue !
    Best Regards
    Zhengyu Guo
    TechNet Community Support

Maybe you are looking for

  • MR11 - GR/IR Clearing account

    Hi There is a Service Purchase order with 2 services in it, amounting to USD 848.00 with a document creation date in 2003. (Note: In the invoice item tab of PO, the Invoice receipt and GR-based IV are both flagged.) The user did a service entry sheet

  • Solaris 2.6 download cd

    sorry for posting in this topic but I can't find other for my problem. I loast my installation cd's that came with my sparcstation ipx and sparcstation 5. the hard drives crashed on both of them first ipx and then ss5. on ipx I put a "new" hdd with d

  • Values in selection screen

    Iam trying to create the drop down list. Well, I got some programs, creating these lists for both parameter and ranges on the selection screen. What the user wants is when the selection screen is loaded, he wants to select from the list OR ENTER ANY

  • Still Photos in FCP and DPI

    if im purchasing stock photos (still) from say istockphoto does DPI even matter in video editing? If the resolution is high enough, which is suppose if im going to a 4:3 output then their "small" size 850x565px 11.8 x 7.8 @ 72DPI would be good enough

  • How to restore Project from repository for specific date ?

    Hello, I have Web Dyn Pro Project. Some files were deleted in project and were checked in to repository. Could you please describe easy steps how to restore project state for specific date ?