1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19 package org.apache.myfaces.orchestra.dynaForm.metadata.impl.hibernate;
20
21 import org.apache.myfaces.orchestra.dynaForm.metadata.MetaFieldWritable;
22 import org.apache.myfaces.orchestra.dynaForm.metadata.impl.ejb.EjbExtractor;
23
24 import java.lang.reflect.AccessibleObject;
25
26 /**
27 * Extract hibernate specific data
28 */
29 public class HibernateExtractor extends EjbExtractor
30 {
31 @Override
32 protected void initFromAnnotations(Context context, MetaFieldWritable mdField, AccessibleObject accessibleObject)
33 {
34 throw new UnsupportedOperationException();
35
36 /*
37 super.initFromAnnotations(context, mdField, accessibleObject);
38
39 if (accessibleObject.isAnnotationPresent(Min.class))
40 {
41 Min annot = accessibleObject.getAnnotation(Min.class);
42 mdField.setMinValue((double) annot.value());
43 }
44 if (accessibleObject.isAnnotationPresent(Max.class))
45 {
46 Max annot = accessibleObject.getAnnotation(Max.class);
47 mdField.setMaxValue((double) annot.value());
48 }
49 if (accessibleObject.isAnnotationPresent(Length.class))
50 {
51 Length annot = accessibleObject.getAnnotation(Length.class);
52 mdField.setMinSize(annot.min());
53 mdField.setMaxSize(annot.max());
54 }
55 if (accessibleObject.isAnnotationPresent(NotNull.class))
56 {
57 mdField.setRequired(true);
58 }
59 if (accessibleObject.isAnnotationPresent(Range.class))
60 {
61 Range annot = accessibleObject.getAnnotation(Range.class);
62 mdField.setMinValue((double) annot.min());
63 mdField.setMaxValue((double) annot.max());
64 }
65 */
66 }
67 }