001    /*
002     * Copyright 2004 Chris Nelson
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
007     * Unless required by applicable law or agreed to in writing,
008     * software distributed under the License is distributed on an "AS IS" BASIS,
009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010     * See the License for the specific language governing permissions and limitations under the License.
011     */
012    package org.tynamo.descriptor;
013    
014    
015    public class IdentifierDescriptorImpl extends TynamoPropertyDescriptorImpl implements IdentifierDescriptor
016    {
017            private boolean generated = true;
018    
019            public IdentifierDescriptorImpl(Class beanType, TynamoPropertyDescriptor descriptor)
020            {
021                    super(beanType, descriptor.getPropertyType());
022                    copyFrom(descriptor);
023                    setSearchable(false);
024            }
025    
026            /**
027             * @param realDescriptor
028             */
029            public IdentifierDescriptorImpl(Class beanType, Class type)
030            {
031                    super(beanType, type);
032                    setSearchable(false);
033            }
034    
035            public IdentifierDescriptorImpl(Class beanType, String name, Class type)
036            {
037                    super(beanType, name, type);
038                    setSearchable(false);
039            }
040    
041            /**
042             * (non-Javadoc)
043             *
044             * @see org.tynamo.descriptor.PropertyDescriptor#isIdentifier()
045             */
046            public boolean isIdentifier()
047            {
048                    return true;
049            }
050    
051            /**
052             * @return Returns the generated.
053             */
054            public boolean isGenerated()
055            {
056                    return generated;
057            }
058    
059            /**
060             * @param generated The generated to set.
061             */
062            public void setGenerated(boolean generated)
063            {
064                    this.generated = generated;
065            }
066    
067            public Object clone()
068            {
069                    return new IdentifierDescriptorImpl(getBeanType(), this);
070            }
071    
072    
073    }