Refactor smart-rs API into 2 modules
[smart-dao.git] / smart-exim / smart-exim-api / src / main / java / com / smartitengineering / exim / EximResourceConfig.java
blobd7c491ec5e78499e2967208c47781743dce80934
1 /*
2 * This is a common dao with basic CRUD operations and is not limited to any
3 * persistent layer implementation
4 *
5 * Copyright (C) 2008 Imran M Yousuf (imyousuf@smartitengineering.com)
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 package com.smartitengineering.exim;
21 import com.smartitengineering.domain.exim.DomainSelfExporter;
22 import com.smartitengineering.domain.exim.DomainSelfImporter;
23 import com.smartitengineering.domain.exim.IdentityCustomizer;
24 import java.util.Map;
26 /**
27 * This API represents the configuration of a class. Two configuration objects
28 * are considered to be equal if they represent the same class.
29 * @author imyousuf
30 * @since 0.4
32 public interface EximResourceConfig {
34 /**
35 * Returns the configuration map for the associations of this resource
36 * object class. Since every type in Java extends {@link Object} we consider
37 * every member in a resource class to be an association and thus store its
38 * configuration in thus manner. Name of the property is the key to the map.
39 * @return A property name keyed configuration map of all the associations
41 Map<String, AssociationConfig> getAssociationConfigs();
43 /**
44 * The resource class it generated this configuration from
45 * @return Class this configuration represents
47 Class getDomainClass();
49 /**
50 * Returns the property name of the ID property of the domain. Resource
51 * objects must either provide a ID property or implement
52 * {@link IdentityCustomizer}. Otherwise the config generator might choose
53 * to throw an {@link IllegalArgumentException}.
54 * @return Name of the ID property or NULL if it implements {@link IdentityCustomizer}
56 String getIdPropertyName();
58 /**
59 * Returns the prefix to the ID and suffix to the path to resource. It will
60 * add '/' in between path and prefix if required.
61 * @return Prefix to the ID.
63 String getIdPrefix();
65 /**
66 * Return the path to the resource.
67 * @return Path to the resource
69 String getPathToResource();
71 /**
72 * Setting for testing whether to access members by property accessors or
73 * field. If access is set by property and a setter is not available that it
74 * will be ignored.
75 * @return True if access is to done by getter/setter and false if
76 * reflection is to be used for setting property value.
78 boolean isAccessByPropertyEnabled();
80 /**
81 * Configuration for specifying export policy of this object when is in
82 * association.
83 * @return True if the resource domain to be exported as URI else inline.
85 boolean isAssociateExportPolicyAsUri();
87 /**
88 * Configuration whether the object is capable to exporting itself or not.
89 * @return True if it implements {@link DomainSelfExporter}
91 boolean isExporterImplemented();
93 /**
94 * Defines whether the resource class implements its own ID customizer. It
95 * also signifies that it implements its own URI provider.
96 * @return True if it implements {@link IdentityCustomizer}
97 * @see EximResourceConfig#getIdPropertyName()
99 boolean isIdentityCustomizerImplemented();
102 * Defines whether the resource has its own importer defined for some
103 * media types.
104 * @return True if it implements {@link DomainSelfImporter} else false
106 boolean isImporterImplemented();