]> git.argeo.org Git - gpl/argeo-slc.git/blob - legacy/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/castor/structure/tree/TreeSPathFieldHandler.java
Remove SlcExecution and process packages
[gpl/argeo-slc.git] / legacy / runtime / org.argeo.slc.support.castor / src / main / java / org / argeo / slc / castor / structure / tree / TreeSPathFieldHandler.java
1 /*
2 * Copyright (C) 2007-2012 Mathieu Baudier
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.castor.structure.tree;
17
18 import org.exolab.castor.mapping.AbstractFieldHandler;
19 import org.exolab.castor.mapping.MapItem;
20
21 import org.argeo.slc.core.structure.tree.TreeSPath;
22
23 public class TreeSPathFieldHandler extends AbstractFieldHandler {
24
25 @Override
26 public Object getValue(Object object) throws IllegalStateException {
27 MapItem part = (MapItem) object;
28 return ((TreeSPath) part.getKey()).getAsUniqueString();
29 }
30
31 @Override
32 public Object newInstance(Object parent) throws IllegalStateException {
33 return null;
34 }
35
36 @Override
37 public Object newInstance(Object parent, Object[] args)
38 throws IllegalStateException {
39 return null;
40 }
41
42 @Override
43 public void resetValue(Object object) throws IllegalStateException,
44 IllegalArgumentException {
45 MapItem part = (MapItem) object;
46 part.setKey(null);
47 }
48
49 @Override
50 public void setValue(Object object, Object value)
51 throws IllegalStateException, IllegalArgumentException {
52 MapItem part = (MapItem) object;
53 part.setKey(new TreeSPath(value.toString()));
54 }
55
56 }