How to design constructor with variable parameters?

I'm working on a "project" where I need to make a class "book" that can store information about a book. It's name, isbn, stock, etc... What is throwing me off a little bit is the author. I'm allowed to enter up to 4 authors per book object. I'm coming at the problem with the assumption, that I should be able to load this author data within the constructor. Questions is how. At first I thought I'd make 4 different constructors, each with a different number of author parameters. Simple enough but it seems unnecessarily messy. Then I thought I'd make a variable length parameter array. e.g book( String ... author ). But what if someone wants to enter more than 4 authors or none at all?
QUESTION:
Is there a way I can set a minimum and maximum of inputs for variable length paramters?
Vectors seem like they could be useful here instead of arrays. But again there is that problem of controlling constructor parameters.

Then I thought I'd make a variable length parameter array. e.g book( String ... author ). (Otherstuff, String author, String ... otherAuthors)
Is there a way I can set a minimum and maximum of inputs for variable length paramters?Validate it in the code itself
Or create another class specifically for Authors
No matter what you do you will still need validation code, for example what if the author is null? Or empty?
     class Authors
            public String Author1;
            public String Author2;
            public String Author3;
            public String Author4;
            public Authors(String auth)
            public Authors(String auth1, String auth2)
       }

Similar Messages

  • How to use Count with Date Parameters

    Hello,
    I am having issues using the Count() function in conjunction with date parameters.
    This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
    Anyone have a suggestion on how to use Count() with date parameters?
    Thanks.

    Any chance you can get the date formats in the correct format from siebel?
    I don't know Siebel - so I can't help you with that. If you get the correct format it is just
    <?count(row[(FromDate>=date) and  (date<=ToDate))?>
    Otherwise the approach would probably need to use string function to get year/monthd/day from the date
    and store it into a varialbe and compare later the same way
    <?variable@incontext:from; ....?>
    <?variable@incontext:to; ...?>
    <?count(row[($from>=date) and  (date<=$to))?>
    Potentially you can use the date functions such as xdofx:to_date to do the conversion
    [http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
    But I am not sure if they are available in your siebel implementation.
    Hope that helps

  • Constructor with no parameters

    Greetings,
    What is a constructor with no parameters?
    Just started on my new lab today and most of its going pretty good. Except I can't get the compiler to go past the first part...which pretty much hangs up the rest. My instructions are to create a constructor with no parameters, and after doing some research I thought I did that. Would someone mind taking at look at this and help me understand what I'm not doing? Thanks.
    I'm only suppose to use the three variables that I've already put in, but the first constructor doesn't want to use any of those.
    public class Time
        // instance variables
        private int hour;
        private int minutes;
        private int seconds;
         * Default constructor for objects of class Time.
        public Time()
            Time();
        }

    public class Time {
        private int hour;
        private int minutes;
        private int seconds;
        // no constructor typed
        public static void main(String[] args) {
            Time t1 = new Time();  // OK
            Time t2 = new Time(5, 5, 5); // error
    }This is Ok for t1 because if you do not provide a default (no args) constructor, one will be supplied when it compiles.
    public class Time {
        private int hour;
        private int minutes;
        private int seconds;
        public Time(int h, int m, int s) {
        public static void main(String[] args) {
            Time t1 = new Time();  // error
            Time t2 = new Time(5, 5, 5); // OK
    }Now ok for t2 since you have provided a constrcutor but not ok for t1 as the default constructor will not be provided for you. Default constructor only provided if you do not provide one.
    public class Time {
        private int hour;
        private int minutes;
        private int seconds;
        public Time() {}
        public Time(int h, int m, int s) {
        public static void main(String[] args) {
            Time t1 = new Time();  // OK
            Time t2 = new Time(5, 5, 5); // OK
    }Now both t1 and t2 are ok since both constructors are been supplied.

  • Report Designer - Query with variable

    Hi!
    When testing the report designer, we have found an issue - it’s not possible to embedding queries with variables.
    We have found note https://websmp107.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=012006153200000232982006
    that suggest a solution to the issue.
    My question is simply, does anyone know if this is a temporary fix, or is this a constraint that is not planned to be fixed by SAP? The note is a bit ambiguous.
    BR
    bjørn

    Hello,
    Queries with variables are still in restrictions for Report Designer.
    You can use this work-arond creating Query View and fill up the variables. This allows you to define a Report in RD. Then, use Web Appication Designer to include your Report into Web Application and replace the Query View with your initial Query.
    For the integration do following:
    1. Create new Web Template in WAD
    2. Drag-and-drop Web Item "Report"
    3. Go to Property Window in WAD and search for "REPORT" (description Report Design) parameter in Web Items Parameters
    4. Use the button on the right side of the parameter to open Report Designer and choose your Report in it.
    5. You should see that new Data Provider was created in WAD -> Open it and set it to your initial Query.
    5. Save you Web Template and execute in the browser.
    Regards, Karol
    Development BI

  • Problem in calling of stored procedure with variable parameters

    Hello!
    When we try to call our stored procudure with variable parameter (year and month) we receive various errors.
    Here's the dynamic package script code:
    DEBUG(ON)
    PROMPT(SELECTINPUT,,,"Please select time for restatement",%TIME_DIM%)
    TASK(Execute formulas,USER,%USER%)
    TASK(Execute formulas,APPSET,%APPSET%)
    TASK(Execute formulas,APP,%APP%)
    TASK(Execute formulas,SELECTION,%SELECTIONFILE%)
    TASK(Execute formulas,LOGICFILE,%APPPATH%\..\AdminApp\%APP%\zbpc_to_fm.lgx)
    TASK(Execute formulas,RUNMODE,1)
    TASK(Execute formulas,LOGICMODE,1)
    TASK(Execute formulas,SIMULATION,1)
    TASK(Execute formulas,CHECKLCK,0)
    Our logic script file (zbpc_to_fm.lgx) code is:
    *RUN_STORED_PROCEDURE=ztest('%TIME_SET%')
    *commit
    The problem occures while transferring the variable parameter %TIME_SET% value.
    How can we correctly transfer the selected value of TIME_SET into the procedure?

    Everything in the debug log looks correct -- the most important lines are the ones indicating the values passed from the user's response to the PROMPT(SELECTINPUT...)
    INFO(%CATEGORY_SET%, BUDGET)
    INFO(%ENTITY_SET%, 1733)
    INFO(%FUND_SET%, )
    INFO(%PROJECT_SET%, )
    INFO(%TIME_SET%, 2008.NOV)
    Are you certain that the stored proc is processing the input parameter for time correctly, when you run it directly in MS Mgmt Studio?
    What error messages do you see running it from BPC?
    By "customized user authorities" do you mean that the time dimension is secured, and this user has access only to 2008.total and its descendants? If that's the case, the user should be able to see only those members in the action pane / current view, but the SELECTINPUT prompt should only show the base members (and not the year total and quarters). I'm still confused as to why all 12 + 4 + 1 members are passed through to the stored proc.

  • How to design templates with Microsoft Excel

    Hi
    When creating a new template in EBS, we have "Microsoft Excel" as one of the the template types (just like RTF). How to design the template if Excel is selected as the template type. I uploaded a blank EXCEL file and the concurrent program errors out with "Excel Processing" exception.

    hi,
    r u uploading the blank excel..r the excel u got from the Analyzer for Excel from the BIpublisher.
    One small clarification on my previous post..like the .xdo not the excel name.Inside the excel it is the sheet name.
    If u uploading the excel that u got from the Analyzer for excel means it should work.
    Plz select the template type as Excel after uploading the template.
    Its working for me.
    This link will be helpful for u
    http://blogs.oracle.com/xmlpublisher/2007/05/16/
    Edited by: Ananth.v on Mar 4, 2010 3:07 PM

  • How to create default web service constructor with optional parameters in C#

    hi senior :)
    i tried to create a web services with a default constructor and another that takes few arguments, no matter
    what i do I couldn't call the non default constructor from the client! how can I pass my arguments in the constructor? worse yet, I tried to pass my arguments to another exposed WebMethod, guess what? the public or private variables i'm trying to update,
    do not get updated, what gives? any documentation on how to use web services? i'm pretty newbie at this. thanks

    http://forums.asp.net/
    You need to post to Web services section in the above forum.

  • How to create table with variable

    hi,
    i m to create many table with same starting name but last name would be vary like
    i m to create table test121 and test122 and so on
    i want to set name test then any given number by variable so i can create many table.
    so how to add it in create table command.
    i tried create table test||:var (column names) but it didnt work.
    so plz suggest me how to do it ?
    thxs

    Actually this is good.
    It has nothing to do with database design. A database is not a garbage bin.
    You need to do several things
    a) make sure your design is normalized so you don't have identical tables.
    b) In future posts specify a platform and a version and the tool you are using to create the table
    c) if the tool is sql*plus learn about substitution variables aka DEFINEs.
    Sybrand Bakker
    Senior Oracle DBA

  • How to manage tasks with variable duration / amount of work

    Hello,
    I'm currently trying to build a macro planning for my department for the next 2 years.
    In my plan, there is a task that has a variable duration and amount of work. People will start / stop working on it depending on the beginning / end of other tasks. The only way to do this I've found so far is to split the task into multiple subtasks
    (one per resource) that are manually scheduled with start and end dates linked to the dates of the tasks they depend on. However, I think this workaround is really not practical and hard to manage since for each subtask I need to create milestones for linking
    the start date to the next working day. Relationships between tasks are also not visible in the plan. I've also read that in general it' better to avoid using links, but is there a better way to manage this in Project 2013 ?
    Best regards,
    Sébastien.

    Seb_Lz,
    There are several elements of your description that need more detail.
    You mention a variable duration. That could simply be a normal task that changes scope as the plan progresses (i.e. more work content, slipping schedule, etc.), or it could be indicative of what is called a hammock task (See Faq 19 on the MVP website at: http://project.mvps.org/faqs.htm).
    You mention linking as a way to define task dependencies. That is exactly what task predecessors and successors are designed to do. Task links have nothing to do with resources. It's not clear why you say only one resource per task.
    You talk about manual scheduling and entering start and finish dates. Manual scheduling is intended for a very rough first cut at a working schedule. To get the full benefit of Project's scheduling engine, tasks should be auto-scheduled and the whole logic
    network sequence of tasks should be defined by durations and links, not by manually entering dates. It's fine to set critical milestones or use Project's deadline feature, but otherwise let Project tell you how your plan all works given the basic data.
    You say relationships are not visible in the plan. Don't understand that at all since link lines between tasks are shown by default in task views (e.g. Gantt Chart view).
    Not sure where you read that it is better to avoid using links because that is flat out wrong, at least for normal predecessor/successor links within a single file. If you are working with a linked structure (i.e. master/subproject), or using external predecessors/successors,
    then yes, links become a whole new area of concern.
    John

  • How to search data with multiple parameters =SESSION

    Dear Günter Schenk
    Please help
    I have two Tables with many fields
    1.       tbl_users
    2.       tbl_transection
    Now problem is that I want when user login he make search in " tbl_usr_transection " related its own Transactions other then he view all user data
    I have one column about user in transaction table i.e. "fld_transection_by"
    I am using SESSION to filter all transaction its related user and its working fine.
    <?php echo $_SESSION['login_id']; ?>=<?php echo $row_rstbl_transections[' fld_transection_by ']; ?>
    Now how to make search from filter rows in many field
    Please explain in detail
    Thanks in Advance

    Hi, It sounds like you need to carry those variables into your mySQL statement.

  • How to design universe with tables from two databases using a db link?

    I am building a universe (v3.1) that has tables from two different oracle db instances.  My dba created synonyms for me and there is a database link in place.  I don't know how to get this working in Designer.  I can see the views under my ID when I browse to insert a table, but there is no structure.  I think I have to create a new strategy.  I attempted to do that, but the directions aren't very clear to me, and it isn't working.  Any help or advice would be greatly appreciated.  Thanks!!

    i've been working with DB links much before, but this was since long time ago before i join the Business Intelligence field
    from my understanding that you Have link from DB1 to DB2
    and from your user in DB1 you can access tables and view from DB2
    if you are using your user to create a universe im not sure if you can use tables from DB2 or not
    and you dont see the tables of the link in the Universe
    but you can try to create a drived table selecting from any tables from DB2
    for example
    select id,name from user.table2@mylink
    check this way and give me your feedback
    good luck

  • How to design applications with security in mind?

    Hi there,
    I�m looking for a book/website anything that can enhance my ability to design security applications in terms of authentication and authorization. I mean, how to set �Groups� of users and to allow/disallow them to use certain functionalities, how to set LEVEL of users, how to log all events, etc�
    Thanks

    I think you need more than an article you need a book. There is alot that makes a secure system secure.
    As just an example a system I am battling with currently has well defined sets of permissions and resources. Resources are accessed through the permissions set to users and/or groups. The owner of the resource is who sets these permissions. This is all good except that the ownership of resources can be pushed and not just pulled.
    This means the rest of the security is rather a waste of time because that's a rather large flaw.
    At any rate. There is a lot to consider and just one article won't cover it. You should be looking for a book and/or resources that deal with this topic ad nauseum.

  • How can i work with variables of the BEx-Query in WAD  ???

    Hi Experts !
    In my Web Template i want to work with the value of a BEx-Variable like this :
    </td>
    <td class="SAPBEXTbsTab" id="head_TAB4"><A href="javascript:if (V_TEST != '1') {goto_tab('TAB4')}">Summenblatt 3</A>
    </td>
    V_TEST is a variable in my BEx-Query.  Does someone know how i can get the value from this variable ???
    Thx Andreas

    to get the query variable value into javascript variable you can do like below
    <script>
    var period_val = '<object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="TEXTELEMENTS_PERIOD"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
             <param name="DATA_PROVIDER" value="DP"/>
             <param name="GENERATE_CAPTION" value=""/>
             <param name="ELEMENT_TYPE_1" value="VARIABLE"/>
             <param name="ELEMENT_NAME_1" value="0P_FPER"/>
             <param name="ONLY_VALUES" value="X"/>
             ITEM:            TEXTELEMENTS_PERIOD
    </object>';
    </script>
    Raja

  • How to use datamerge with variable lengths of text?

    Hello,
    I'm looking for a way to automaticly format brochures from a database . I allready found out that datamerge lets you do this quite easily. But I encounter a problem when I use large amounts of text.
    How I see it, the only solution is to reserve enough space for the larges text in order to make all of the text appear in the document. But this leaves large open spaces and even blank pages in my document when I deal with less text.
    Is there a way to make the document adapt to the amount of text? So that Indesign creates more space for large amounts of text and erases blank pages when there is less text?
    Maybe Datamerge isn't the right solution for my problem, I'm open to suggestions.
    Thanks in advance!
    Iris

    I'm just finishing up a directory that I build with data merge and I have the problem of variable length business descriptions, as well as some have extra mailing addresses or websites. My solution is to do it in several steps with multiple files. I do a normal merge first (and I use a single record per page for this, but only bcause that allows me to create some alphabetical lists of business names and owners's names that I can key to a listing number), then I stitch together the individual stories into a single text thread that I copy/paste into place in the final document. If you have a lot of frames, Rorohiko.com has a nifty text stitch script that will help.
    One tip that helps with this method is to be sure you have a paragraph break at the end of each story so stiching the frames together maintains your paragraphs.

  • Overriding constructors with static parameters?

    I have an abstract class named Stuk with the following constructor:
         public Stuk(boolean rdstuk, String soort){
              roodstuk = rdstuk;
         }and i have a couple of subclasses like this one:
    public Maarschalk(boolean rdstuk, soort){
              super(rdstuk, "maarschalk");
         }with soort being a static string that differs in every subclass
    i tried this because i want to be able to make an object of a certain subclass without making if-else constructions to make sure the proper constructor is used.
    ofcourse, the static variable method doesnt work
    any other suggestions?
    thanks in advance

    oh sorry i misposted the constructors
    code of the constructor of abstract class Stuk:
    public abstract class Stuk{
         /* instantievariabelen:
          private boolean roodstuk;
         public Stuk(boolean rdstuk,final String soort){
              roodstuk = rdstuk;
         }code of the constructor of subclass Maarschalk
    public class Maarschalk extends Stuk{
         private final static int level = 11;
         private final static Figuur f = StrategoMain.figuren.getFiguur("maarschalk").scaleer(StrategoBord.portretbreedte, StrategoBord.portrethoogte);
         private final static String soort = "maarschalk";
         /* CONSTRUCTOREN:
          *Maarschalk(boolean rdstuk, soort)
         public Maarschalk(boolean rdstuk,"maarschalk"){
              super(rdstuk, "maarschalk");
         }error when trying to compile Maarschalk:
    "illegal start of type"

Maybe you are looking for

  • Firewire 800 hub not working

    After two years without incident, all my drives (5) stoped mounting on my 17" Macbook Pro (running Lion).  They are connected though a hub -- NitroAV 8 port Firewire 800 hub.  I have changed the cable -- no effect.  I have tried connecting the drives

  • Is there a way to bulk delete records

    It seems that I have a a lot of duplicated records in my " central " area so I wanted to either filter by Area then delete the duplicates if there is a way to do that or bulk delete every record that is "Central" in the Area column.. is that possible

  • Result row is not showing expected result

    Dear All , I have below  requirement to generate mix variance    PY Mix PY Mix Diff   PY Mix   Val Gr - 0.00 0.00 1,015.6823529 1,015.68 0.00 0.00 52,486.5048653 52,486.50 0.00 0.00 2,836.1166667 2,836.12 0.00 0.00 45,582.8437071 45,582.84 Result 0.0

  • No Response from Server at end of day:  4.03

    We're using Weblogic 4.03 on Solaris. At the end of a busy day, users start submitting their transactions and some users start calling the help desk saying that performance is very slow and I believe they are getting "No Response from Server" from th

  • Show ip route / routing table

    hi all, i have a question regarding the output of the "show ip route" command: C         192.168.30.0/24 is directly connected, Ethernet0                                               172.16.0.0/24 is subnetted, 1 subnets S          172.16.1.0 is dir