Hiding methods and attributes while inheriting
Hello All,
This is kinda urgent. While making a subclass I want to block access to methods and attributes of super class when anone creates an object of sub-class. In my particular situation I cannot override the methods.
Let me explain it with an example:
I have a class A which contains an attribute of type Object. All the methods accept Object type parameters and act accordingly. Now I want to create a sub-class B which acts on Strings only. I can create a wrapper to class A but I want to add some behavior which is specific to strings and use rest of the behavior as in class A. I cannot override the methods of class A because they take Objects as parameters whereas in class B the same methods take string as parameters.
I hope you have understood the problem. Please reply ASAP.
Thanks in advance
Sorry the diagram turned out wrong. ObjectClass and StringClass are both supposed to be derived
from the AbstractBaseClass.
This method is one way to achieve what you want. You make an AbstractBaseList class that has only
protected methods that take objects.
To implement a generic Object version of this class you extend it and override the protected methods in
the AbstractBaseList class to make them public.
To implement a String list you extend the AbstractBaseList class and override the protected methods to
make them public (but change the type of the parameters).
The only problem with this approach is that the return types of the methods cannot be changed. Therefore
I recommend the AbstractBaseList implement a method called
protected Object getByIndex(int i) {
// do list type stuff in here
Then the ObjectList can implement
public Object get(int i) {
return super.getByIndex(i);
and the StringList can implement
public String get(int i) {
return (String) super.getByIndex(i);
In effect all you need to do is to implement wrapper classes that enforce type casting on the Object based
set/get values.
Another option is to use JDK1.5 with its generics classes. These effectivly allow you to specify which type of
object an instance of a class accepts.
Another question. What is the matter with the Collections classes provided in the JDK?
matfud
Similar Messages
-
Overriding methods and attributes
can a subclass override a method in its superclass even if it changes the method`s access modifier? can attributes be "overriden" as well?for instance:
//superclass
class A implements Serializable{
public int attr;
public void run () {
//subclass
class B extends class A {
transient int attr;
private void run() {
}will public int attr of class A be "overriden" by transient int attr of class B? and did class B override the run method?
thanks!while overriding a method, you cannot make the method being overriden more 'private'. That means if a method is public in the parent class, you can not make it package or protected in the child class and so on.
As far as overriding the attributes is concerned, I haven't seen anything like that and I think it's not allowed. The transient int in B is different that the public int in A.
Correct me if I am wrong.
Thanks. -
Do the Interface contains static components like static methods and attribu
Do the Interface contains static components like static methods and attributes ?
>
You have to supply a bit more detail: is that Lotus
Notes API a Java API?Hmm, It's Java interface to Lotus Notes API
Does it use JNI? Perhaps it is used somewhere underneath, I do not know for sure, but I think so
Possibly the Lotus Notes
implementation keeps a
reference to those arrays, who knows?
Maybe, but I'd be really suprised if it did. I derive this thread from Lotus Notes class and provide my own "worker method", overriding Lotus API abstract one, where I reference arrays. Arrays are specific to my program and since they are private fields in thread's class Lotus Notes layer does not have any way of referencing them, nor any reason for this matter
For starters: if you zero out (set to null) your
references to those arrays
in your threads when the threads finish, there might
surface a useful
indication that you can blame Lotus Notes for this
Well, I've become deeply suspect of whether these Notes' threads do really finish :-) My method finishes for sure, but it is just a part of run() method of Lotus Notes thread. Anyway, you can always safely blame Lotus Notes for almost anything :-) -
Payment method and cost center validation check in MIRO while save or simul
Hi,
I want to put a validation check between payment method and cost center while posting MIRO against PO (MIGO done) . If my payment method and cost center matches then system should allow that entry otherwise should popup a message .
We tried this with user_exit - EXIT_SAPLMRMP_010 enhancement LMR1M001 .
But thing is it is not getting triggered at all either at the time of simulation or at the time of saving . We are also looking into BADI - update_invoice .
Any body having any idea on this please share.
ThanksHi,
Please don't open multiple threads for the same question..Please close this one..
THanks,
Naren -
Method, parameters and attributes
Dear SAP friends!
Could anybody explain me how to find possible values of a parameter?
Here is an example:
CALL METHOD o_picture->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_fit_center.
Parameter "display_mode" has 4 possible values. The parameter values could be found in Attributes Tab.
But how I can identify that these 4 values are related to "display_mode" parameter?
Let's say I want to use method "set_display_mode" of class "cl_gui_picture".
I go to SE84 and display the class. Then I find the method I want to use and click "parameters". Then I see the parameter "display_mode".
I know that possible values of the parameter could be found in Attributes Tab. But there so many of them...
How do I know which is which? Clicking on "display_mode" doesn't give any information and there is no documentation available in English...
Thanks,
TatyanaYes, this is a little bit tricky at times. But the class, method, attributes are designed to be intuitive, meaning that the wording of the methods and and attributes are described in such a way that it is easy to recoginize what contansts can be used to pass to method calls. Lets take the class CL_GUI_DOCKING_CONTAINER for example. Lets look at the CONSTRUCTOR method and its parameter SIDE. You will see that this parameter is of TYPE I and that it is actually using on of the constants as its default, DOCK_AT_LEFT. So if you go to the attributes tab and look for DOCK_AT_LEFT, you will find other contants that are available to pass to this parameter.
If you are looking for a hard list of values(or constants in attributes tabs) which can be passed to any given parameter of any given method, I do not believe that this functionality exists.
REgards,
Rich Heilman
Regards,
Rich Heilman -
Oracle.jbo.AttrValException: JBO-27019: Get method for attribute
Hi Guys,
I am trying to add a new column to Oracle quoting.It has already been customized by some consultant few years back. I followed the note 392728.1 on metalink and also have the documentation by the previous consultant but getting the error oracle.jbo.AttrValException: JBO-27019: Get method for attribute Draft in HeaderVO could not be resolved after adding my column, when I try to print the quote.
Here are the steps I took
1) added a column to the query (at the end) in HeaderVO.xml
2) added the below code in the HeaderVO.xml
<ViewAttribute
Name="DRAFT"
IsQueriable="false"
IsPersistent="false"
Precision="100"
Type="java.lang.String"
AliasName="DRAFT"
ColumnType="VARCHAR2"
Expression="DRAFT"
SQLType="VARCHAR" >
<DesignTime>
<Attr Name="_DisplaySize" Value="100" />
</DesignTime>
</ViewAttribute>
3). Modify HeaderVORowImpl.java file to add setters and getters for the newly added view attribute. For example,
a) case 67: //
setDRAFT((String)obj);
return;
b) case 67:
return getDRAFT();
c) ublic void setDRAFT(String s)
setAttributeInternal(67, s);
public String getDRAFT()
return (String)getAttributeInternal(67);
d) protected static final int DRAFT = 67;
Everything is dont exactly as per the manual but not sure why I am getting this issue. Any help will be appreciated.a) case 67: //
setDraft((String)obj);
return;
b) case 67:
return getDraft();
c)public void setDraft(String s){
setAttributeInternal(67, s);
public String getDraft(){
return (String)getAttributeInternal(67);
d) protected static final int DRAFT = 67;
can u change it as explained above.. setDRAFT should be setDraft.. and getDRAFT should be getDraft..
and make sure that the index.. number is exactly matching with the attribute order in the VO -
Session method and call transaction methos which one is the sap recomonded
hi
PLease give me the answer to these questions.
session method and call transaction methos which one is the sap recomonded why .
2) if we want to maintain BDC program in all the systems.wt to d0Hi Revethi,
Here is the difference between the Session and Call Transaction method.
Session
Session method supports both small amount of data aswell as large amount of data
2) data processing is asynchronus and data updation is synchronus.
3) it process multiple apllication while perfomaning validations.
4) in session method data will be updated in data base only after processing session only.
5) system provide by default logfile for handling error records.
6) it supports both foreground aswell as background process
in bdc we use FM ... bdc_open_group " for creating Session
bdc_insert " adding transaction and bdcdata table for updating database
bdc_close_group " for closing Session
Call Transaction
Call transaction exclusively for small amout of data
2) it supports only one apllication while perfoming validations
3) there is no default logfile, We can explicitly provide logic for creating logfile for handling error records.
we can create logfile by using structure....BDCMSGCOLL
4) it doesn't support background processing.
5) data processing is synchronous and Data updation is Synchronous( default), in
this method also supports daya updation in asynchronus process also.
Syntax:
Call transaction <transaction-name> using BDCDATA
mode <A/N/E> update <L/A/S>
messages into BDCMSGCOLL. -
Difference between text data and attributes in master data?
Hello,
a charcteristic in BW maintains texts, hierarchies and attributes.
What exactly is the difference between texts and attributes?
Attributes describe master data like a customer. The country where the customer resides, the industry etc. describe and classify the customer. Attributes are not just the structure/metadata of the characteristics. They are also the content. The following table should visualize what i mean:
customer-no. | name
112 | mcpherson inc.
113 | donalds inc.
Texts contain contain the description of a characteristic. Texts define a characteristic. An example is the customers name. It does not describe the customer but defines him/her.
Is my understanding about these two parts of master data right?
What else except the customer's name belongs to the texts?
If I set up a characteristic like the customer in SAP BW, do I have to create an attribute "name". The name belongs to texts, not to attributes?? If I upload master data then, how does it work?
Thanks in advance.Hi,
If your analysis includes country and region then country and region should be included in the Infocube.This is required because only if you include these characteristics then you can restrict your queries for country and region.You may need to select some particular countires/region and show the report.Then you have to restrict your queries to only those countries/region.This is possible only if you have these characteristic in your infocube.
I am just envisaging your model like this.
Characteristic in the Infocube
Customer
Country
Region
Customer Attributes
Customer Number (SID which is self generated)
Customer Address1,2 ,3
Registration No
Date of Registration
Deposit Amount
etc ...
Region Attributes
Region Number (SID)
Total Customers
Sale Office Address
Number of Sales Persons
Customer Attributes
Customer Number (SID)
Total Customers
Head Office Address
Number of Sales Persons
GDP
Total Population
So the conclusion is whichever entity you want to restrict or analyse should be a part of Infocube.It is very difficult to do analysis based on attributes as I mentioned in my earlier post that they are only "Display attributes" (u can just show that's it).
Yes!! there are methods available for analysis based on characteristics in attributes table and you have to do either with virtual characteristic or replacement path or with writing code in customer exits.But a good design and earlier study of all possible report combination and having a good design will avoid good amount of development time and changes.
I have suffered when I had only 0CALDAY in my cube and when I want to take a monthly analysis, I was unable to do it and then I have to redesign my whole cube.
Please anyone, correct me if I am wrong.
Regs
Gopi. -
Payment method is declining while reviewing account
payment method is declininbg while reviewing account
Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
Please read very, very carefully. If you've already created an account, then you cannot easily change it. -
I'm a beginner in Java and just learn about abstract method and class.
However, i am wondering what is the point of using abstract method/class?
Because when I delete the abstract method and change the class name to public class XXXX( changed from "abstract class XXXX), my program still runs well, nothing goes different.
Is it because I haven't encountered any situation that abstract method is necessary or ?
Thanks!Yes - you probably haven't encountered a situation where you need an abstract.
Abstract classes are not designed to do anything on their own. They are designed to provide a template for other classes to extend by inheritance. What you have build sounds like a concrete class - one which you are creating instances of. Abstract classes are not designed to be ever instantiated in their pure form - they act like a partial building block, which you will complete in a class which extends the abstract.
An example might be a button class, which provides some core functionality (like rollover, rollout etc) but has an empty action method which has to be overwritten by a relevant subclass like 'StartButton'. In general, abstract classes may not be the right answer, and many people would argue that it is better to use an interface, which can be implemented instead of extended, meaning that you can ADD instead of REPLACING.
Not sure if that helps.. there are whole chapters in books on this kind of thing, so it's hard to explain in a couple of paragraphs. Do some google searches to find out more about how they work. -
LR 5 functions, methods, and properties not in LR 4 docs
While we're waiting for the SDK docs, I scanned for functions, methods, and properties not documented in the LR 4 SDK. Here's what I found:
LrCatalog
Methods:
assertHasReadAccess
buildSmartPreviews (array of LrPhoto)
createPublishService
createVirtualCopies
getPhotoByLocalId
withReadAccessDo
Properties:
allPhotos
hasCatalogAccess
hasReadAccess
hasWriteAccess
path
targetPhoto
targetPhotos
LrCollection
Methods:
getSearchDescription
LrController
nextPhoto
previousPhoto
showBezel
showGrid
showLoupe
startSlideshow
stopSlideshow
triggerCapture
LrDialogs
closeFloatingDialogsForPlugin
presentFloatingDialog
presentWebViewDialog
showBezel (string message, [number fadeDelay])
showStringsDialog
LrDigest
HMAC
MD4
MD5
SHA1
SHA256
SHA384
SHA512
LrLogger
Methods:
configure
restoreConfiguration
saveConfiguration
wrapMethodWithTrace
wrapMethodsWithTrace
Properties:
_actions
_name
_savedConfigurations
will_debug
will_error
will_info
will_trace
will_warn
LrPhoto
Methods:
applyDevelopSnapshot
buildSmartPreview
deleteDevelopSnapshot
deleteSmartPreview
getDevelopSnapshots
locationIsPrivate
readMetadata
requestJpegThumbnail
saveMetadata
withSettingsForPluginDo
Properties:
countStackInFolderMembers
countVirtualCopies
isInStackInFolder
isVirtualCopy
localIdentifier
masterPhoto
path
stackInFolderIsCollapsed
stackInFolderMembers
stackPositionInFolder
uuid
virtualCopies
LrPhotoPictureView
makePhotoPictureView
LrPlugin
nativeFunction
LrPublishService
delete
getAllRemoteIds
promptEditDialog
LrPublishedCollection
Methods:
getSearchDescription
publishSelected
setSearchDescription
LrPublishedCollectionSet
Methods:
delete
LrPublishedPhoto
Methods:
getDevelopSettingsDigest
getMetadataDigest
LrTableUtils
debugDumpTable
LrUUID
generateUUID
LrView
Methods:
path_control
square_button
LrXml
xmlElementToSimpleTable
I didn't examine the classes LrExportContext, LrExportRendition, LrExportSession, LrExportSettings, LrFilterContext, LrVideoExportPreset, LrWebViewFactory.jarnoh wrote:
catalog:createVirtualCopies()
I can't get this to create multiple virtual copies .
jarnoh wrote:
it seems to create virtual copies for active selection.
I assume you mean one virtual copy for each selected photo(?)
Active selection meaning the (one) "most" selected photo, i.e. catalog:getTargetPhoto().
jarnoh wrote:
Takes as many copy name strings as many photos are selected.
I tried passing array of copy name strings, and get internal error: "WFSqliteStatement:bind() - illegal data type used as value".
I tried passing one string, which works, but then it only makes one copy.
I tried unpacking the names array (i.e. passing each as a separat parameter) - again, it only makes one copy, it having the first name passed.
What am I doing wrong??
UPDATE:
~~~~~~~
I'm still working on this, but note: return array is not necessarily freshly created virtual copies, nor are all photos returned guaranteed to be virtual - worth checking what gets returned at least until you've got it figured out (I don't, yet).
I've been able to get it to create one copy, just fine, but can't get it to create multiple copies.
Note: omitting all parameters, it creates one copy named "Copy N", or you can pass a string to be used as copy name. I just don't know how to pass multiple names and get it to create multiple copies.
Has anybody actually gotten catalog:createVirtualCopies to create more than one virtual copy (with a single call I mean) ???
PS - Worth noting: this function does not need to be called with catalog write access, strangely enough (but maybe that's part of the problem I'm having? - only does one copy if no catalog write access???).
~~~~~~~
Thanks in advance,
Rob -
Missing method and period category after transportation
I did a flexible upload, one method for the flexible upload and one task.
I the task I defined period category = "mensual" and method = "EEFF"
When I transported it, when I check in PRD in the task I have Period Catergory ="anual" and with out a method.
I create a new flexible upload, method and task and I transorted again. And it still wrong.
¿What can I do?Hi Laura,
I had faced the same issue while transport.
In the second time while transporting the same task , I have attached the method to task one period before also in UCWB and I period later also in UCWB.
For example if I need to transport the task effective from 001/2008, I attached the method to task with opening in UCWB parameters 012/2007,001/2008,002/2008.
It worked for me. Hope this inputs helps.
Best regards, -
Check Required Elements and Attributes in JAXB
Hi
I need check required elements and attributes in JAXB java classes , if there are any value for them place it , otherwise place default value in xml file , because of it I upgrade JAXB2.0 to JAXB 2.1 to support "required" in "XmlElement" , I read in "JavaWS(JAXB)Tutorial.pdf" that JAXB itself check required elements and attributes , if there are any value for them place it , otherwise place default value in xml file , the exact part of document is :
<< A property is said to have a set value if that value was assigned to it during unmarshalling or by invoking its mutation method. The value of a property is
its set value, if defined; otherwise, it is the propertys schema specified default value, if any; otherwise, it is the default initial value for the propertys base type as it would be assigned for an uninitialized field within a Java class. >>
I want to know , dose JAXB do this task ? (now I work with JAXB2.1 but it doesnt do this task.Maybe I must set some configuration)
and if JAXB doesnt do it , how I can check required elements and attributes in JAXB ?
Please help me.
Shariatits all on Apple's Developer site
http://developer.apple.com/DOCUMENTATION/AppleApplications/Reference/FinalCutPro _XML/index.html -
How to call Instance Methods and set property values in BAPI?
In Project systems, for the three business objects viz.
Network, ProjectDefinition and WBS, there are two kinds of methods which are available : class methods and instance methods. We have tried calling some instance methods, for instance, BAPI_PROJECTDEF_GETDETAIL to get details pertaining to a project. While importing this BAPI, it shows two elements for mapping i.e. Current Internal Project(string) and Current External Project(string). We supplied these values for an existing project. Upon running this call through an XML client at our end, it
returned an error "Module Unknown Exception". This general message is present on every instance method thus far. Upon searching in BAPI Explorer for Project System->ProjectDefinition->GetDetail, we found that this BAPI didn't take any input parameter.
Following message was displayed in BAPI Exlorer for this BAPI:
"... Obligatory import parameters are the external and internal keys CURRENTEXTERNALPROJE and CURRENTINTERNALPROJE of the project definition.The system reads parameters contained in the structure
BAPI_PROJECT_DEFINITION_EX ..."
i) How to supply the values of Obligatory import parameters.
ii) What are the possible causes of this exception.
iii) How to call an instance method. We are using same mechanism for calling class as well as instance methods so far, we have been to call only class level methods successfully. Is there anything special that we
need to do to call instance methods.Hi,
what version is the SAP PS running? If WebAs or higher, create an inbound synch interface containing your two parameters in the request structure and as many as you require in your response structure. Generate an Inbound ABAP proxy, where you can plug in some code, i.e. create and instantiate an object of the required type and make the call to the BAPI.
If SAP PS on lower than WebAs, then create a wrapper function module and make it RFC enabled. Then plug your code in here and do the same thing.
Watch out for commits!
Cheers,
Mark -
Open hub destination of text and attribute for Functional Area
Hi Expert
I have a requirement to accommodate both attribute ( 0FUNCT_LOC_ATTR) and text ( 0FUNCT_LOC_TEXT ) for functional area in open hub destination .For this a DSO has been created from both 0FUNCT_LOC_ATTR, 0FUNCT_LOC_TEXT data sources .Problem is that DSO has 0FUNCT_AREA ( Functional Area ) as only key fields . So text for both english ( EN ) and Dutch ( NL) for particular 0FUNCT_AREA not getting loaded .If we assign both 0LANGU and 0FUNCT_AREA as composite key of dso , data from attribute transformation is loaded as blank as there is no language filed in attribute data source ( 0FUNCT_LOC_ATTR ). Please let me know how can I design to accommodate both text for different language and functional area for open hub destination .
I know that I can create separate open hub destination for master data TEXT and Attribute.
Any help is highly appreciated.
Regards
SaikatHI Saikat,
You can create an additional characteristics counter and make it a key field in the DSO.After that we can populate this characteristics in the end routine .It value would increase by 1 everytime different text comes for the same functional area.
Sample code
data: counter type n,
w_farea type /bio/oifunc_area.
Sort result_package by func_area.
count =0.
*checking whether we have the same functional area or we have a different functional area.
Loop at result_package assigning <Result_fields>.
if w_farea is initial or w_farea = <result_fields>-func_area.
count = count +1.
else
count =1.
endif.
w_farea= <result_fields>-func_area.
<Result_fields>-zcount = count.
ENDLOOP.
Clear w_farea.
This way the value of counter would get increased by one everytime a new text comes for the same functional area.We can have any number of texts for the same functional area by this method.
The only issue would be when some delta update comes for the existing text in this method.If you are doing a full load to the DSO from the datasource, then there would be no issue with this method.
Maybe you are looking for
-
I was wondering if there was a way to add new fonts to Pages. I recently purchased a new iMac that came standard with Pages. I'm resisting the urge to install Microsoft Word as I prefer Pages in many ways. However, I'm frustrated that I can't use/fin
-
How to find out the missing records
Dear all, I feel that there is some Inconsistent records between R/3 and the extracted records BI for the data source 2LIS_03_BF. some of the records may not be updated through delta.. Is this possible? as we have created Zkey figures to capture the
-
Macbook Pro not receiving Mail
My iPhone receives Mail, but all of a sudden my Macbook stopped receiving Mail. Everything appears to be operating fine connection-wise. Does anyone have any ideas?
-
How to create inprocess insp. lot manually
HI Team, I have requirement to create inprocess inspection lot as & when required. What are the settings required to do in QM view insp. type. I have tried with "Preferred inspection type" set up, but no inspection lot is allowed to create manually
-
HT201303 I've downloaded some apps and can't remember how to send tomy iphonesend it to my phone
I've downloaded a few apps to my computer but I have forgotten how to send them to my iphone as its been ages since I've done this.