How to get protected fields
Hello,
I don't know how to get protected fields that a class inherits from its superclass through reflexion ... the getDeclaredFields method seems not working ...
here is my test program:
import java.io.File;
import java.lang.reflect.Field;
public class Test {
public static void main(String[] args) {
Field [] fieldList = SubClass.class.getDeclaredFields();
for (Field field: fieldList) {
field.setAccessible(true);
System.out.println (field.getName());
static class SuperClass {
protected File file;
public SuperClass () {
file = new File ("a.txt");
static class SubClass {
private File myfile;
public SubClass () {
myfile = new File ("b.txt");
The output is
myfile
This means, the getDeclaredField method of the SubClass returns only fields declared by this class, not protected fields declared by its superclass.
Anyone has an idea to fix the problem, please help me. Thank you a lot
}
That's not a problem, the documentation specifically says that getDeclaredFields() only returns fields from this class. If you want fields from the superclass, why not just getSuperclass().getDeclaredFields()?
Similar Messages
-
How to get a field that using variable in order to create a query
Hi,
I found a difficulty when creating a query. so, I would like to ask you some question.
1. How to get a field that using variable which that field I want to put it in my query?
For example, I would like to take quantity field in inventory audit report. And when I put my cursor in
quantity field, there was only variable, item, etc. How to get this and put it in query?
2. How to combined the invoice quantity with inventory audit report quantity?
3. I have a query like this:
SELECT distinct T0.[DocDate] as 'Tanggal', T0.[DocNum] as 'No.Faktur', T1.[ItemCode] as 'Kode Barang',
T1.[Dscription] as 'Deskripsi', T1.[Quantity] as 'Quantity', ((T1.[LineTotal])/(T1.[Quantity])) as 'Harga
Satuan', T1.[LineTotal] as 'Harga Total', T3.[CalcPrice] as 'HPP Satuan', ((T3.[CalcPrice]) * (T1.
[Quantity])) as 'HPP Total', T4.[ItmsGrpNam] as 'Jenis Barang', T5.[SlpName] as 'Nama Sales', T1.
[WhsCode] as 'Kode Gudang' FROM [dbo].[OINV] T0 INNER JOIN [dbo].[INV1] T1 ON T0.DocEntry =
T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OINM T3 ON T2.ItemCode
= T3.ItemCode INNER JOIN OITB T4 ON T2.ItmsGrpCod = T4.ItmsGrpCod INNER JOIN OSLP T5 ON
T0.SlpCode = T5.SlpCode WHERE T3.[TransType] = '13' and T3.[CreatedBy] = T1.[DocEntry] and T0.
[DocDate] >=[%0] and T0.[DocDate] <=[%1] and T4.[ItmsGrpNam] =[%2] and T1.[WhsCode] =[%3]
Is it possible if I just take one invoice with invoice quantity and only show up at once although I have a
lot item cost for that item? (because I'm using FIFOmethod).
Please help me.. cause I'm stuck with this thing :l.
Thank you very much, and I'm waiting your respon soon.
Regards,
SiscaTry this one:
SELECT distinct T0.DocDate as 'Tanggal', T0.DocNum as 'No.Faktur', T1.ItemCode as 'Kode Barang',
T1.Dscription as 'Deskripsi', T1.Quantity as 'Quantity', ((T1.LineTotal)/(T1.Quantity)) as 'Harga
Satuan', T1.LineTotal as 'Harga Total', T3.CalcPrice as 'HPP Satuan', ((T3.CalcPrice) * (T1.
Quantity)) as 'HPP Total', T4.ItmsGrpNam as 'Jenis Barang', T5.SlpName as 'Nama Sales', T1.
WhsCode as 'Kode Gudang'
FROM dbo.OINV T0 INNER JOIN dbo.INV1 T1 ON T0.DocEntry =T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OINM T3 ON T2.ItemCode = T3.ItemCode AND T3.TransType = '13' and T3.CreatedBy = T1.DocEntry AND T3.Warehouse = T1.WhsCode
INNER JOIN OITB T4 ON T2.ItmsGrpCod = T4.ItmsGrpCod
INNER JOIN OSLP T5 ON T0.SlpCode = T5.SlpCode
WHERE T0.DocDate >=[%0\] and T0.DocDate <=[%1\] and T4.ItmsGrpNam =[%2\] and T1.WhsCode =[%3\]
Thanks,
Gordon -
How to get the field COMPLETION in extract layout
Hi,
Does anyone knows How to get the field COMPLETION in extract layout? i have not been able to find it and it is imperative to have it for implementing a new evaluation.
Thanks a lot for your help.
CAMILO URIBEHi Neil,
The following steps describe what we did to get the new evaluation:
1. Define Attributes and Object Types for Evaluations: here we added a new field for evaluation. The field was COMPLETION (degree of processing in percent), with relevant object "TASK". "No Summarization" was configurated as Rule for Summarization
2. Define Extract Layouts: here we created a new extract layout for evaluation. The objects and attributes to be used were defined (the field COMPLETION was defined as attribute).
3. Assign Extract Layouts to Project Types.
4. Define Evaluations: the new layout for evaluation were created using the attributes.
5. Define Severity.
6. Define Threshold Values. In the new evaluation the field COMPLETION was used in the formula.
After configurating and testing, we have noticed that the values of field COMPLETION are not taking into account. It does not matter which value it has, evaluation always take 0.
Thanks for your help,
CAMILO URIBE -
How to get the field name of an internal table during runtime?
How to get the field name of an internal table during runtime?
Hi Sudhir,
Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
Example Code:
<b> DATA: v_field(60). " Insert this code.
GET CURSOR FIELD v_field. " Insert this code.</b>
<b>CHECK v_field = 'ITAB-KUNNR'. " Insert this code. (or)
Write: v_field.</b>
Regards,
Ramganesan K. -
How to get two fields with same tech name in LIS Extractors?
Hi Experts,
I need "ERDAT" field from two structures (QMSM & QMFE) in 2LIS_18_IOTASK extractor.
In LBWE first I moved ERDAT from QMSM. When I moved ERDAT from QMFE it gives an error:
"Field with same technical name is already available in the Extract Structure".
I don't want to create Append Structure as we need to write User exit.
Can any one tell me how to get this field added in the extractor from QMSM and QMFE?
Thanks for your help.
Regards,
Sreethis is not possible as the all those fields are put in one structure. per definition you can't put the same field name twice in a structure, table in the data dictionary...
hence, you really need to use an append and fill via user exit
M. -
How to get item field values for old versions?
I need to be able to query old field values from previous versions of items in a SharePoint list. I can't execute code on the server (it needs to work with SharePoint Online/O365 for a start).
So far the ONLY API I've that lets me do this is the lists.asmx GetVersionCollection SOAP call.
This lets me specify a single field name and returns an XML structure with the values for the various versions, along with the modification time and who made the change - but NO reliable way of actually identifying *which* version (i.e. an ID or label). That
is, if I know I need to fetch the Title value from version 512 ("1.0") of item 1 in list "Documents", I don't see how to reliably parse the results to determine which entry is version 512. While they may be returned in order, in many cases
the entries are actually missing when there was no field value present (or perhaps when the field hadn't been created yet). I've tried comparing the Modified date to the Created date of the corresponding FileVersion item (which I can get via CSOM or REST),
and while it works some of the time, it's not reliable. I've also looked at the output from the lists.asmx GetVersion API but I don't see how that's useful either, as the Created property for all versions always seems to be just the date the file was originally
created.
It does seem odd to me that there's not a neat way of doing this - if I need to return information for several fields but just for a single version, I have to make a whole lot of requests that return far more info than I need, and then I need to figure out
how to parse the returned text in the case of, say, multiple-value taxonomy fields etc.
Anyone tried doing anything similar here?
Thanks
Dylantry these links:
https://support.office.microsoft.com/en-us/article/Track-and-view-version-information-for-SharePoint-list-items-2d69d936-fb0b-4c84-830e-11708e6ec317?CorrelationId=f87cf6ea-8cbf-446a-a4a0-e2c3a86b3425&ui=en-US&rs=en-US&ad=US
https://social.technet.microsoft.com/Forums/en-US/e48ff216-7ed1-4b20-9f21-d496b1583eea/how-to-get-item-field-values-for-old-versions?forum=sharepointdevelopment
http://sharepoint.stackexchange.com/questions/20019/get-meta-data-from-a-previous-version-of-a-document-through-webservice-in-moss-2
http://sharepoint.stackexchange.com/questions/121594/getting-information-from-previous-versions-of-a-sp-list-using-csom
Please mark answer as correct if it is correct else vote for it if you find it useful Happy SharePointing -
How to get protected method ?
I thought i can get protected method of my class when calling a Class.getMethod(String, Class []) in another class which inside the same package. However, it seem that i can't do that because it throw me a NoSuchMethodException when the method was protected. I thought all classes in same package can access the protected methods or fields of each other ??? Why ?
So, how i'm able to get the protected method in runtime ? (Hopefully no need to do anything with the SecurityManager)It is working
Pls try the following program ...
public class p1 {
public static void main(String as[]) {
p2 ps2 = new p2();
ps2.abc();
class p2 {
protected void abc() {
System.out.println("Hello");
regards,
namanc -
How to get private fields from super class?
Hi.
I must get protected and private fields from a class. I know that sounds werid but I have a very good reason for doing so, ask if you want.
I have tried the getDeclaredField(String) method, but it apparently doesn't return the fields declared by the super classes.
What's the smartest solution to this?
Thank you all.
edit: note that the superclass hierarchy's length is 3 and that there are several classes at the bottom level.
Edited by: bestam on Sep 24, 2009 2:05 PMbestam wrote:
I do not claim I have invented a new programming language Sir, you must be mistaken. This is not turing complete.
This is a language for describing Cards or a game's rules if you want.
AspectJ isn't Turing complete but AspectJ is still a compiler.
This is how I have been working :
- I have implemented the core library in Java (what is a Player, what is an Effect, what is a Card, what is a BuildingCard, what is a Player's Turn and so on)
- It also includes packages dedicated to service, able to retrieve and send data to the clients via sockets.
- Then I have "hardcoded" a dozen of specific cards in Java, for testing and validating the core library. I have been doing so by extending the BuildinCard's class for example.
- But my ultimate goal is not to code thoses 1.000+ cards of the game in Java. I chosed to design a little language so that I would end up writing cards faster. While I'm traversing the syntactical tree representing the card, I feed the card's fields one by one. Some of them are quite primitive, some other are more complex and have a recursive nature for instance.
Providing detail for how you implemented it doesn't change anything about what I already said.
Thus, this is not really a compiler as it doesn't transform a text in language A into a text in language B.
You really need to understand more about what "compilers" and certainly compiler theory do before you decide what they can and cannot do.
And your statement still does not change what I said.
Is this wrose than the bean design pattern from JSP ? I'm not sure.
Bean design? A "bean" has almost zero requirements.
Aside of that, it's a bit harsh to be told "read the fucking manual" while I have written my first compiler some years ago.Not sure who that was directed. I suggested some reading material on compiler theory.
If you think that your idea is ideal then knock yourself out. Since I doubt I will end up seeing it in anything that I must maintain it doesn't matter to me. But you did in fact ask what the best solution was. -
How to get additional field from the second list base on lookup information column ?
Hi everyone,
Currently I created a SharePoint hosted Apps project and I need to know how can I get additional field from the second list base on lookup information column. example List1 Have 2 columns column1 and column2(Lookup Information from list2 (category)),
List2 have 3 columns title, and category, and color. so how can get the title and color from list2 base on this lookup information column (SharePoint Hosted apps and Javascript code)? that is possible?
Best regards,
------------------------------------------------------------ ---Tola---You can build one custom lookup control. Refer to the following post
http://www.stuartroberts.net/index.php/2012/10/03/enhanced-lookup-field-part-1/
Alternatively, try the following solution from codeplex
http://sp2010filteredlookup.codeplex.com/
http://filteredlookup.codeplex.com/
--Cheers -
How to get Changed fields in Sales order to create a report
Dear Gurus,
How to get the log from sales order for the change of particular field.
In my scenario, If an user remove the delivery block from sales order I want to capture the date on which this delivery block
is removed and by whom (User)?
I know that I can get the log of change but can I get in the form of field updates because further I want to use that date and user name to create a report.
I hope u got my query. Please reply soon that I can create a report.
Thanks in advance.
regards,
SanjayHi
You can use the table CDPOS for tracking the changes at the Table level with the Sales order number
or Else you can also use AUT10 transaction to track the logs/chanages with START DATE, END DATE and the Transaction code in your case it is VA02
Please check and revert back
regards,
santosh -
Base on invoice list document no. how to get MATKL field
my question is regardsing, based on the provided invoice list document number, how to get MATKL (merchadise category) field from MARA table or other table. Thanks
In the invoice document if you have the material number, MATNR, then take that and using that you can get the MATKL from the MARA table.
Regards,
Ravi
Note : Please mark all the helpful answers -
How to get custom field value in vbkd table using "SD_SALESDOCUMENT_CREATE" bapi
Hi Experts,
Need your help . In one program Iam using SD_SALESDOCUMENT_CREATE bapi .
i/p for my report is am excel.
excel is having below formatt.
To create salesdoc we are using SD_SALESDOC_CREATE bapi.
but After execution of the program we are unable to find the ZZFV_SBCNT (which is custom field) in VBKD w.r.t salesdocument.
Need your help what we need to do to reflect the value in vbkd table.
Here temp will contains the data from excel
1)
FORM f_move_header_data .
wg_header-doc_type = wg_temp-auart . "Order type
wg_header-sales_org = wg_temp-vkorg . "Sales Organization
wg_header-distr_chan = wg_temp-vtweg . "Distribution Channel
wg_header-division = wg_temp-spart. "Division
wg_header-sales_off = wg_temp-vkbur . "Sales Office
wg_header-sales_grp = wg_temp-vkgrp . "Sales Group
wg_header-purch_no_c = wg_temp-bstnk . "Customer purchase order number
wg_header-pymt_meth = wg_temp-zlsch . "Payment Method
wg_header-zzychan_role = wg_temp-zzychan_role_i. "Channel Role
wg_header-zzysub_role = wg_temp-zzysub_role . "Submitter Role
wg_header-zzy_inv_for_opt = wg_temp-zzinv_format . "Invoice Format Optio
wg_header-ord_reason = wg_temp-augru . "Order Reason Code
wg_header-bill_block = wg_temp-faksp. "Billing Block
wg_headerx-doc_type = c_set . "Order type
wg_headerx-sales_org = c_set . "Sales Organization
wg_headerx-distr_chan = c_set . "Distribution Channel
wg_headerx-division = c_set. "Division
wg_headerx-sales_off = c_set . "Sales Office
wg_headerx-sales_grp = c_set . "Sales Group
wg_headerx-purch_no_c = c_set . "Customer purchase order number
wg_headerx-pymt_meth = c_set . "Payment Method
wg_headerx-zzychan_role = c_set. "Channel Role
wg_headerx-zzysub_role = c_set . "Submitter Role
wg_headerx-zzy_inv_for_opt = c_set . "Invoice Format Option
wg_headerx-ord_reason = c_set . "Order Reason Code
wg_headerx-bill_block = c_set. "Billing Block
ENDFORM. " F_MOVE_HEADER_DATA
2)
FORM f_move_item_data .
wg_item-itm_number = g_itmnumber. "Item number
wg_item-material = wg_process-matnr . "Material
wg_item-target_qty = wg_process-target_qty. "Targeted Qty
wg_item-item_categ = wg_process-pstyv. "Sales document item category
wg_item-zzylegal_i = wg_process-zzlegal. "Legal Contract
**********Added this line for vbkd-ZZFV_SBCNT****************************
wg_item-zzfv_sbcnt = wg_process-zzfv_sbcnt.
APPEND wg_item TO i_item.
wg_itemx-material = c_set . "Material
wg_itemx-target_qty = c_set. "Targeted Qty
wg_itemx-item_categ = c_set. "Sales document item category
wg_itemx-zzylegal_i = c_set. "Legal Contract
wg_itemx-zzsteady_date = c_set . "Amortization Start Date
wg_itemx-zzsteady_end_dat = c_set. "Amortization Stop Date
**********Added this line for vbkd-ZZFV_SBCNT****************************
wg_itemx-ZZFV_SBCNt = c_set. "
APPEND wg_itemx TO i_itemx.
CLEAR : wg_itemx.
endform.
3)
FORM f_move_head_ext
wg_extension-structure = c_ext_vbak.
wg_ext_vbak-zzinv_format = wg_temp-zzinv_format.
wg_ext_vbak-zzychan_role = wg_temp-zzychan_role_i.
wg_ext_vbak-zzysub_role = wg_temp-zzysub_role.
wg_extension+30 = wg_ext_vbak.
APPEND wg_extension to i_extension.
CLEAR wg_extension.
wg_extensionx-structure = c_ext_vbakx.
wg_ext_vbakx-zzinv_format = c_set.
wg_ext_vbakx-zzlegal = c_set.
wg_ext_vbakx-zzychan_role = c_set.
wg_ext_vbakx-zzysub_role = c_set.
wg_extensionx+30 = wg_ext_vbakx.
APPEND wg_extensionx TO i_extensionx.
CLEAR wg_extensionx.
ENDFORM. " F_MOVE_HEAD_EXT
*& Form F_MOVE_ITEM_EXT
* Item Extension
4)
FORM f_move_item_ext .
* Structure for BAPI parameter Extension
wg_extension-structure = c_ext_vbap.
wg_ext_vbap-posnr = g_itmnumber.
wg_ext_vbap-zzsteady_date = wg_process-zzsteady_date . "Amortization Start Date
wg_ext_vbap-zzsteady_end_dat = wg_process-zzsteady_end_dat. "Amortization Stop Date
wg_ext_vbap-zzlegal = wg_process-zzlegal. "Legal Contract
wg_extension+30 = wg_ext_vbap.
APPEND wg_extension to i_extension.
* Structure for BAPI parameter Extension - Update Indicator Fields
wg_extensionx-structure = c_ext_vbapx.
wg_ext_vbapx-posnr = g_itmnumber.
wg_ext_vbapx-zzsteady_date = c_set .
wg_ext_vbapx-zzsteady_end_dat = c_set.
* wg_ext_vbapx-zzlegal = c_set.
*wg_process-zzfv_sbcnt = c_set.
wg_extensionx+30 = wg_ext_vbapx.
APPEND wg_extensionx TO i_extensionx.
CLEAR wg_extensionx.
and bapi calling is like below.
CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'
EXPORTING
sales_header_in = wg_header
sales_header_inx = wg_headerx
logic_switch = wg_logic_switch
business_object = fp_bus_obj
status_buffer_refresh = 'X'
IMPORTING
salesdocument_ex = g_sorder
TABLES
return = i_return
sales_items_in = i_item
sales_items_inx = i_itemx
sales_partners = i_partner
sales_conditions_in = i_cond
sales_conditions_inx = i_condx
sales_text = i_text
extensionin = i_extension
extensionex = i_extensionx.
still we are not getting ZZFV_SBCNT value in VBKD table w.r.t created salesdoc(g_sorder)
Please help me from this issue.
Thank You..Hi,
Please let me know how to add custom fields in the characteristic list, My clients wants department and profit center grouping.
Please tell me how to solve it..
Thanks & Regards,
Reena.. -
How to get the field names of a table
hi all,
i need to get all field names of a table. here i dont need any data. i need only field names.
initially i used this query, select * from tname;
the problem is if table have 1000 records, all records will be in memory.
how to get this one.
regards
pavan.hi all,
thanks a lot. the query is working.
initially i given this query
select column_name from user_tab_columns where table_name='mytable';
but no rows selected.
and i tried with this,
select column_name from user_tab_columns where table_name='MYTABLE';
this is working fine.
thanks
pavan. -
How to get these fields ???
can any help out ...
i used the field like j_2icomp-cl_fin for fetching the finished data
the probelm here the data is coming but some data is going out of other column
for example 100 ,200 ,300 is data .. 100 and 300 r printing in correct postion under the finshed column where as 200 is going out of column ....
I created a script for daily stock .. here i wanted to fill the data from the fields..
for example date field j_1irg1_cpdut is filed name for fetcing the date ...
like wise for rate of duty and excise amount i needed the fields . how to get those fieldsThese field names are not even spelled properly, please ask your "functional ppl".
Thread locked.
Thomas -
How to get the field's type in the database with jdbc?
How to get the one filed's type(varchar,int,long...etc) with jdbc??
Can u help me??
It's best that giving a sample code..Thx for your reply,BheegaChicken! But i use it with
oracle9i jdbc..It doesn't return to my the fields
type correctly..
This is problem is caused by oracle jdbc??
Can u tell me??It depends on the driver classes you are using... some of them don't have an implementation for those methods and you won''t get anything useful. Check the driver documentation.
***Annie***
Maybe you are looking for
-
Where do I find the "plug in" for IE in the adobe program,
After countless hours trying to get on line pdfs to open in IE8 on XP SP3 uninstalling, installing lastest versions of reader, IE8, and changing settings ad nausium, I am still only able to get them to open in Fire Fox. Looking through all the progra
-
To get a row of value by taking table name and primary key value
i can't find out what's wrong.. pliz help.. m a fresher in SAP. code is here PARAMETER tname(10) TYPE c. PARAMETER pkv(10) TYPE c. DATA: lt_dd03l TYPE STANDARD TABLE OF dd03l, ls_dd03l TYPE dd03l. DATA: my_table TYPE REF TO data, wa_ref TYPE REF TO d
-
Private iTunes U: Upload error
Attempting to upload content to my private ITunes U and am getting this error: Error: Upload Failed. Try again. Users are still able to download content. To clarify, even as the iTunes U Admin I am unable to upload content. On my public site, I am
-
Why Oh Why has my mac mail stoped working. After years its gone tits up. Keeps saying MobileMe IMAP server "mail.me.com" rejected the password for user blah blah blah. tried everything. son now ive deleted the thing of the computer can this thing be
-
Which PHP editor do you use?
Hello programmers Which php editor do you use? Which is the best you think? I use php Designer & think it's the best