How to get the attribute...?

well im trying to create JTable from a vector which will contain random Objects from random classes haveing random number of attributes for example:
class x{
int id;
String name;
String surname;
class y {
String title;
String author;
etc.
like i said i have a vector of such objects and wanna make a JTable from it... i tried to make it like this:
JTable table = new JTable(vector a, vector b)
but i get nullpointer exception because (i supose) vector b had objects of class x and it cant be converted somehow to JTable rows...
so im trying to make an array[][] which should contais all objects with all attributes of one of those classes
well i dont know if u will understand what im talking about cause my english sux...
anyway the problem is that:
lets say i have a vector containing:
new x(1,"a","b")
new x(2,"x","y")
etc
lets say my vector is v
how to get gor example any string from first object?
i had something like this:
v.get(i).getClass().getFields()[k]
where:
- i is the i element in vector
- k is the attrribute which i wanna get
i tried many combinations (after i get Field) but all i get was something like:
java.lang.reflect.Field
or
java.lang.String
and i want to get for example "a" not a type:/
plz helkp me if u can or tell me how to do something like this in other way:/
thx alot for all answers...

well it is not a Swing problem...
maybe u dont understand the problem...
lets say i have a class
Person{
int id;
String name;
String surname;
and the array in main:
Person[] people;
lets say that there is 100 people...
and i wanna to outprint first person surname BUT without useing Person class methods...
so i should do something like
System.out.pintln(""+
Person[1].getClass().... <--> and what next?
in other words how to get and outprint a String attribute from java.lang.Class

Similar Messages

  • How to get the attribute value of an XML file??

    How to get the attribute value of an XML file??
    For example, how to get name and age attributes?
    <student name="Joe" age="20" />

    What are you using to read the XML file??
    On the assumption of JDOM - www.jdom.org. Something along the lines of:SAXBuilder builder = new SAXBuilder(true);
    Document doc = builder.build(filename);
    Element root = doc.getRootElement();
    List children = root.getChildren();
    Element thisElement = (Element)children.get(n);
    String name = thisElement.getAttributeValue("name")
    try
         int age = Integer.parseInt(thisElement.getAttributeValue("age"));
    catch (Exception ex)
         throw new InvalidElementException("Expected an int.....");
    }Ben

  • How to get the attribute values out?

    Hi everyone,
    <root>
    <category name="Mens Clothing" id="0">
    <subcategory>Active/Baselayer Tops</subcategory>
    <subcategory>Active/Baselayer
    Bottoms</subcategory>
    </category>
    <category name="Womens Clothing" id="1">
    <subcategory>aaa</subcategory>
    <subcategory>bbb</subcategory>
    </category>
    </root>
    How to get the attribute values out? For example "Mens
    Clothing" and "Womens Clothing".
    // the line below returns "Active/Baselayer Tops" and
    "Active/Baselayer Bottoms"
    var myXml:XML = new XML(event.result);
    Thanks,
    May

    Here is attribute identifier operator from FB Help:
    @ attribute identifier Operator
    Usage myXML.@attributeName
    Identifies attributes of an XML or XMLList object. For
    example, myXML.@id identifies attributes named id for the myXML XML
    object. You can also use the following syntax to access attributes:
    myXML.attribute("id"), myXML["@id"], and myXML.@["id"]. The syntax
    myXML.@id is recommended. To return an XMLList object of all
    attribute names, use @*. To return an attribute with a name that
    matches an ActionScript reserved word, use the attribute() method
    instead of the @ operator.
    Operands attributeName:* — The name of the attribute.
    Example
    How to use examples
    The first example shows how to use the @ (at sign) operator
    to identify an attribute of an element:
    var myXML:XML =
    <item id = "42">
    <catalogName>Presta tube</catalogName>
    <price>3.99</price>
    </item>;
    trace(myXML.@id); // 42The next example returns all attribute
    names:
    var xml:XML =<example id='123' color='blue'/>
    var xml2:XMLList = xml.@*;
    trace(xml2 is XMLList); // true
    trace(xml2.length()); // 2
    for (var i:int = 0; i < xml2.length(); i++)
    trace(typeof(xml2
    )); // xml
    trace(xml2.nodeKind()); // attribute
    trace(xml2
    .name()); // id and color
    } The next example returns an attribute with a name that
    matches a reserved word in ActionScript. You cannot use the syntax
    xml.@class (since class is a reserved word in ActionScript). You
    need to use the syntax xml.attribute("class"):
    var xml:XML = <example class='123'/>
    trace(xml.attribute("class"));

  • How to get the Attributes of the UNIX  file Directories  ?

    Hi Guru,
    How to find of the Attributes of the UNIX  file Directories in sap  TC  :-   u2018 *ZZWT*u2019   .
    The file attribute details need to show in the report.
    I try on FM : EPS_GET_FILE_ATTRIBUTES
                       /SDF/GET_FILE_INFO
    But not getting the attributes details.
    If any idea plz. Help me.
    Regards,
    Subash

    Which basis release do you use?
    From 7.0 you have [GET DATASET|http://help.sap.com/abapdocu_70/en/ABAPGET_DATASET.htm] statement
    Before, you may only get what you see in AL11 : mimic what is in program RSWATCH0
    Or you may register and use [UNIX commands (SM69 transaction / SXPG|http://help.sap.com/saphelp_nw70/helpdata/en/fa/0971e1543b11d1898e0000e8322d00/frameset.htm]) and get the results
    Edited by: Sandra Rossi on Aug 2, 2009 12:39 AM

  • ADF: How to get the attributes' values of one single row from a table?

    Currently I have a table with 3 attributes, suppose A,B and C respectively. And I've added an selectionListener to this table. That means when I select one single row of this table, I wish to get the respective value of A, B and C for that particular row. How do I achieve this?
    suppose the method is like:
    public void selectionRow(SelectionEvent se) {            //se is the mouse selection event
    .......??? //what should I do to get the values of A\B\C for one single row?
    Edited by: user12635428 on Mar 23, 2010 1:40 AM

    Hi
    Assuming you are using Jdev 11g.
    Try with this
    public void selectionRow(SelectionEvent se) {
    String val = getManagedBeanValue("bindings.AttributeName.inputValue");
    public static Object getManagedBeanValue(String beanName) {
    StringBuffer buff = new StringBuffer("#{");
    buff.append(beanName);
    buff.append("}");
    return resolveExpression(buff.toString());
    public static Object resolveExpression(String expression) {
    FacesContext facesContext = getFacesContext();
    Application app = facesContext.getApplication();
    ExpressionFactory elFactory = app.getExpressionFactory();
    ELContext elContext = facesContext.getELContext();
    ValueExpression valueExp =
    elFactory.createValueExpression(elContext, expression,
    Object.class);
    return valueExp.getValue(elContext);
    Vikram

  • How to get the attribute of a selected row in a label

    Hi all,
    I am using Jdeveloper 11.1.1.2 and ADF.
    I have a table with two columns, Id and Name. Furthermore I have an outputText where I would like to see the field Name of the selected Row in the table.
    How have I to set the property "value" of the outputText to do this?
    Thank you
    Andrea

    Hi Andrea,
    If you are using ADFBC, the easiest way is to drop the attribute(Say Name) from the data control palette as outputText component and add partialTriggers property of it to point to table id(to refresh the outputText whenever the row is selected in table)
    Sireesha

  • Portal Development: How to get the attribute names of a node in view/page?

    I am not able to find any standard method or a way to find the number of attributes and names of those attributes of a node at runtime.
    is there any other way of doing it?
    if i am misssing something(quite possible as i am just 2 weeks old in ES) please let me know.
    regards
    Nitin

    Thanks Robin,
    i was able to get a work around for this. For the time being i am using the following code snippet, i will try using the one u sent an will see if this works too.
    // create nodeinfo object for the node that table will bind to
    final IWDNodeInfo nodeinfo = wdThis.wdGetContext().node<NODENAME>().getNodeInfo() ;
    //get the structure of the node
    final IStructure struct = nodeinfo.getStructureType() ;
    Iterator iter = nodeinfo.iterateAttributes() ;
    if (null != struct)
    totalFields = struct.getNumberOfFields();
    else
    for ( Iterator i = nodeinfo.iterateAttributes(); i.hasNext(); i.next() )
              totalFields++;
    for(count = 1; count <= totalFields; count++)
         fieldName = nodeinfo.getStructureType().getField(count).getName();

  • How to get the Attributes of file ?

    Hi Guru,
    How to find of the Attributes of file in sap u2018 AL11u2019.
    The file attribute details need to show in the report.
    If any idea plz. Help me.
    Regards,
    Subash

    The attributes you can see from , go tofile part level in the directory. Place the cursor on file name and choose menu option
    Log file ->attributes.
    Edited by: Raja gurrala on Jul 31, 2009 1:16 PM

  • OMBRETRIEVE: HOW i get the attribut which is connected to a given attribute

    Hello!
    I want to know the operator, the group and the attribute which is connected to a given attribute in a mapping.
    I have the statement for the operator:
    OMBRETRIEVE MAPPING 'MAPTAK_BBUE_101' GET OPERATORS CONNECTED TO ATTRIBUTE
    'DWH_SZ' OF GROUP 'INGRP1' OF OPERATOR 'SPLIT'
    Could anybody tell me the statements for the group and the attribute or the way to get this information?
    Thanks in advance
    Message was edited by:
    adietze
    Message was edited by:
    adietze

    Hi,
    I'm afraid there is no single command to get this information. I use a loop like the following:
    set map "MAP_DIM_DEPOT"
    set targetAttribute "DEPOTNUMMER"
    set targetGroup "TARGET"
    set targetOperator "DIM_DEPOT"
    set opList [OMBRETRIEVE MAPPING '$map' GET OPERATORS CONNECTED TO ATTRIBUTE '$targetAttribute' OF GROUP '$targetGroup' OF OPERATOR '$targetOperator']
    foreach op $opList {
      set grpList [OMBRETRIEVE MAPPING '$map' OPERATOR '$op' GET GROUPS CONNECTED TO ATTRIBUTE '$targetAttribute' OF GROUP '$targetGroup' OF OPERATOR '$targetOperator']
      foreach grp $grpList {
        set attrList [OMBRETRIEVE MAPPING '$map' OPERATOR '$op' GROUP '$grp' GET ATTRIBUTES CONNECTED TO ATTRIBUTE '$targetAttribute' OF GROUP '$targetGroup' OF OPERATOR '$targetOperator']
        foreach attr $attrList {
          puts "$op.$grp.$attr"
    }Regards,
    Carsten.

  • How to get the attribute of the xml tag

    I have the following xml file
    Example.xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <html><set label="09/07/29" value="1241.90"/>
    </html>
    Can any one help me in parsing this xml file
    I want to retrive the attribute values of the tag set
    Example I want to store 09/07/29 to variable1 and 1241.90 to variable2 in order to insert this data into a database table.
    Appreciate if any one can help me..very urgent

    Dup post.
    Answers provided at {message:id=3658564} and {message:id=3658522}

  • How can I get the attribute of another app of the JSP server's session

    in one server, use Tomcat 4.1, have two application at
    .../webapps/app1
    .../webapps/app2
    when use login to application1, it'll set a attribute of session use following code:
    session.setAttribute("identitycode", IdentityCode);
    session.setMaxInactiveInterval(SessionTimeOut);
    and the other jsp programs which at app1 directory will try to get the attribute of this session to identity whether the user had login and get the identity code.
    I want to make user just login one time to use application1 and application2, but I didn't know how to get the attribute of session what seted at app1 in app2's programs.
    can you tell me how I can do this?

    If there are 2 different applications like app1 & app2, U need to use:
    application.setAttribute() method.(not session.getAttribute).
    u need to maintain one collection like hash table which will store the mappings of User & their IDs . U can then get the user details from app1 to app2

  • How to get zclass attribute's value inside  "Execute_default" method

    Hi all,
    I am displaying a link in UD step under "Objects & Attachmnents".I am using zclass. I created a attribute in zclass and i am creating a instance (background task) before this UD step and i will be setting a attribute of the zclass inside this create instance method.
    My problem is, if i click the link, this method "BI_OBJECT~EXECUTE_DEFAULT_METHOD" is getting executed but i am not able to get the attribute value inside this method, eventhough i am setting the attribute value before the UD step.
    Pls let me know, how to get the attribute's value inside "Execute_default" method, as i need to process further using this attribute.
    P.S: I tried with both static & instance attribute. I can achieve the same using ZBO but my client needs to use only class.
    -Vinoth
    Edited by: S Vinoth on Jan 29, 2010 7:23 AM

    Lei,
    If you are concerned only about a couple of attributes, then you can manage with a separate copy of the data. But if the data is in bulk, better leave it to pl/sql side of validation.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get the values and attributes of Longlived processes by using ProcessID.

    Hi Experts,
    For  every process we creates, LC ES2 creates processID.
    we know that if you creates  a long lived process, all  the  values which are in proces will be stored some where  in DB.
    Here my requirement is by using  processID I need to get all/some values/variables stored in database.
    I am not able to get values using processID. Here I don't have clue on  how to get the values.
    Please tell me  how to get the same by using  Process Management. Link/guide would be helpful
    Thanks
    Praveen.

    Searchable means you can put a filter criteria on it (e.g. where amount > 50000)
    Visible means you can add have this column returned as an output (and therefore you can add it as column in listview and see it in Task Details).
    These two attributes were provided so that queries could be done against the process variables, but the exact contents of the variables are not allowed to be seen.

  • How can I get the attributes details like user name, mail , from sAMAccount csv or notepad file through powershell or any other command in AD?

    How can I get the attributes details like user name, mail , from sAMAccount csv or notepad file through powershell or any other command in AD?

    Ok what about If i need to get all important attributes by comparing Email addresses from excel file and get all required answers
    currently I am trying to verify how many users Lines are missing , Emp numbers , Phones  from AD with HR list available to me.
    I am trying to Scan all the AD matching HR Excel sheet and want to search quickly how many accounts are active , Line Managers names , Phone numbers , locations , title , AD ID .
    these are fields I am interested to get in output file after scanning Excel file and geting reply from AD in another Excel or CSV file
    Name’tAccountName’tDescri ption’tEma I IAddress’tLastLogonoate’tManager’tTitle’tDepartmenttComp
    any’twhenCreatedtAcctEnabled’tGroups
    Name,SamAccountName,Description,EmailAddress,LastLogonDate,Manager,Title,Department,Company,whenCreated,Enabled,MemberOf | Sort-Object -Property Name
    Can you modify this script to help me out :)
    Hi,
    Depending on what attributes you want.
    Import-Module ActiveDirectory
    #From a txt file
    $USERS = Get-Content C:\Temp\USER-LIST.txt
    $USERS|Foreach{Get-ADUser $_ -Properties * |Select SAMAccountName, mail, XXXXX}|Export-CSV -Path C:\Temp\USERS-ATTRIBUTES.csv
    #or from a csv file
    $USERS = Import-CSV C:\Temp\USER-LIST.csv
    $USERS|Foreach{Get-ADUser $_.SAMAccountName -Properties * |Select SAMAccountName, mail, XXXXX}|Export-CSV -Path C:\Temp\USERS-ATTRIBUTES.csv
    Regards,
    Dear
    Gautam Ji<abbr class="affil"></abbr>
    Thanks for replying I tried both but it did not work for me instead this command which i extended generated nice results
    Get-ADUser -Filter * -Property * | Select-Object Name,Created,createTimeStamp,DistinguishedName,DisplayName,
    EmployeeID,EmployeeNumber,Enabled,HomeDirectory,LastBadPasswordAttempt,LastLogonDate,LogonWorkstations,City,Manager,MemberOf,MobilePhone,PasswordLastSet,BadLogonCount,pwdLastSet,SamAccountName,UserPrincipalName,whenCreated,whenChanged
    | Export-CSV Allusers.csv -NoTypeInformation -Encoding UTF8
    only one problem is that Manager column is generating this outcome rather showing exact name of the line Manager .
    CN=Mr XYZ ,OU=Users,OU=IT,OU=Departments,OU=Company ,DC=organization,DC=com,DC=tk

  • In Jsp TagLib how can I get the Attribute value (like JavaBean) in jsp

    Dear Friends,
    TagLib how can I get the Attribute value (like JavaBean) in jsp .
    I do this thing.
    public void setPageContext(PageContext p) {
              pc = p;
    pc.setAttribute("id", new String("1") );
              pc.setAttribute("first_name",new String("Siddharth")); //,pc.SESSION_SCOPE);
              pc.setAttribute("last_name", new String("singh"));
    but in Jsp
    <td>
    <%=pageContext.getAttribute("first_name"); %>
    cause null is returing.
    Pls HELP me
    with regards
    Siddharth Singh

    First, there is no need to pass in the page context to the tag. It already is present. How you get to it depends on what type of tag:
    Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/SimpleTagSupport.html]SimpleTagSupport
    public class MyTag extends SimpleTagSupport
      public void doTag()
        PageContext pc = (PageContext)getJspContext();
        pc.setAttribute("first_name", "Siddharth");
        pc.setAttribute("last_name", "Singh");
        pc.setAttribute("id", "1");
    }Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html]TagSupport or it's subclass [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/BodyTagSupport.html]BodyTagSupport the page context is aleady declared as an implicit object:
    public class MyTag extends TagSupport
      public void doStartTag()
        pageContext.setAttribute("first_name", "Siddharth");
        pageContext.setAttribute("last_name", "Singh");
        pageContext.setAttribute("id", "1");
    }In each case, this sort of thing should work:
    <mytags:MyTag />
    <%= pageContext.getAttribute("first_name") %>I

Maybe you are looking for